vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 05b028983ef0d202945321a5c1c483f2b3da8c3f
parent 976d4b6f4af7beedfd3a9ac6ef9af90e1358de90
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 12 Sep 2014 15:49:06 +0200

Make sure that the state is consistent after an undo operation

When performing an undo operation, further changes should not be
accounted to the then active action. Therefore take a snapshot
which resets txt->current_action to NULL.

Diffstat:
Mtext.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/text.c b/text.c @@ -550,6 +550,8 @@ bool text_insert(Text *txt, size_t pos, const char *data) { size_t text_undo(Text *txt) { size_t pos = -1; + /* taking a snapshot makes sure that txt->current_action is reset */ + text_snapshot(txt); Action *a = action_pop(&txt->undo); if (!a) return pos;