From cd2bf1fc91d7d940ebd32be0ef60d04d0f2a8af1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 6 Feb 2019 12:55:26 +1100 Subject: Fix T61191: First undo step missing in text editor --- source/blender/editors/space_text/text_undo.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c index 869c7d03af9..88a37e8e51d 100644 --- a/source/blender/editors/space_text/text_undo.c +++ b/source/blender/editors/space_text/text_undo.c @@ -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) -- cgit v1.2.3