aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-12 15:49:06 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-12 15:51:52 +0200
commitf34c99b1d5337d402c049af21c9ec8f1fe6ef02a (patch)
tree0d3342bd3264e6f22e80a75fb3b56ab2a7d95688
parent996c8019e45c7ee268ebc7388142e9ff10d4726d (diff)
downloadvis-f34c99b1d5337d402c049af21c9ec8f1fe6ef02a.tar.gz
vis-f34c99b1d5337d402c049af21c9ec8f1fe6ef02a.tar.xz
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.
-rw-r--r--text.c2
1 files changed, 2 insertions, 0 deletions
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;