Fix T61191: First undo step missing in text editor
authorCampbell Barton <ideasman42@gmail.com>
Wed, 6 Feb 2019 01:55:26 +0000 (12:55 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 6 Feb 2019 01:59:38 +0000 (12:59 +1100)
source/blender/editors/space_text/text_undo.c

index 869c7d03af93fb9704021e292e58d6342dfdd6fb..88a37e8e51dd614518ae9ab6b6de1fb1537a105f 100644 (file)
@@ -65,16 +65,11 @@ typedef struct TextUndoStep {
        TextUndoBuf data;
 } TextUndoStep;
 
-static bool text_undosys_poll(bContext *C)
+static bool text_undosys_poll(bContext *UNUSED(C))
 {
-       Text *text = CTX_data_edit_text(C);
-       if (text == NULL) {
-               return false;
-       }
-       if (ID_IS_LINKED(text)) {
-               return false;
-       }
-       return true;
+       /* Only use when operators initialized. */
+       UndoStack *ustack = ED_undo_stack_get();
+       return (ustack->step_init && (ustack->step_init->type == BKE_UNDOSYS_TYPE_TEXT));
 }
 
 static void text_undosys_step_encode_init(struct bContext *C, UndoStep *us_p)