From f34c99b1d5337d402c049af21c9ec8f1fe6ef02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 12 Sep 2014 15:49:06 +0200 Subject: 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. --- text.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'text.c') diff --git a/text.c b/text.c index ad422c5..a9685e4 100644 --- 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; -- cgit v1.2.3