Fix T59165: Text operations fail to undo
authorCampbell Barton <ideasman42@gmail.com>
Wed, 9 Jan 2019 03:07:35 +0000 (14:07 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 9 Jan 2019 21:01:50 +0000 (08:01 +1100)
Some undo operations encode multiple actions, now all are undone/redone.

source/blender/editors/space_text/text_undo.c

index 729522cc8f43cc33fe2be35a65d6efee167e1e76..b79a77a4353f0381eae212ace5b7291fa8666327 100644 (file)
@@ -121,12 +121,18 @@ static void text_undosys_step_decode(struct bContext *C, UndoStep *us_p, int dir
 
        if (dir < 0) {
                TextUndoBuf data = us->data;
-               txt_do_undo(text, &data);
+               while (data.pos > -1) {
+                       txt_do_undo(text, &data);
+               }
+               BLI_assert(data.pos == -1);
        }
        else {
                TextUndoBuf data = us->data;
                data.pos = -1;
-               txt_do_redo(text, &data);
+               while (data.pos < us->data.pos) {
+                       txt_do_redo(text, &data);
+               }
+               BLI_assert(data.pos == us->data.pos);
        }
 
        text_update_edited(text);