[Bf-blender-cvs] [9012ad155c4] master: Fix T59165: Text operations fail to undo

Campbell Barton noreply at git.blender.org
Wed Jan 9 06:10:24 CET 2019


Commit: 9012ad155c4f92a48f9c684c0dc5c7dd9a481cca
Author: Campbell Barton
Date:   Wed Jan 9 14:07:35 2019 +1100
Branches: master
https://developer.blender.org/rB9012ad155c4f92a48f9c684c0dc5c7dd9a481cca

Fix T59165: Text operations fail to undo

Some undo operations encode multiple actions, now all are undone/redone.

===================================================================

M	source/blender/editors/space_text/text_undo.c

===================================================================

diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c
index b8ae9972eec..29871bf5c85 100644
--- a/source/blender/editors/space_text/text_undo.c
+++ b/source/blender/editors/space_text/text_undo.c
@@ -120,12 +120,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);



More information about the Bf-blender-cvs mailing list