Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-28 12:09:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-28 12:09:09 +0300
commitf22ef1706d440cfdc91af99a8d4ab9952fad882b (patch)
tree466710c92a804d96b1d311daf41df0e67fe8a1f1 /source/blender/editors/space_text/text_autocomplete.c
parent274bde23fb57c014af727fb787c6e8a3342f6240 (diff)
Fix T55662: Crash on text autocomplete
Regression from undo system upgrade.
Diffstat (limited to 'source/blender/editors/space_text/text_autocomplete.c')
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 9163831c333..4f6a3bc82ba 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -40,7 +40,10 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "ED_text.h"
+#include "ED_undo.h"
#include "ED_screen.h"
+
#include "UI_interface.h"
#include "text_format.h"
@@ -284,10 +287,11 @@ static int text_autocomplete_invoke(bContext *C, wmOperator *op, const wmEvent *
ED_area_tag_redraw(CTX_wm_area(C));
if (texttool_suggest_first() == texttool_suggest_last()) {
- TextUndoBuf *utxt = NULL; // FIXME
+ TextUndoBuf *utxt = ED_text_undo_push_init(C);
confirm_suggestion(st->text, utxt);
text_update_line_edited(st->text->curl);
text_autocomplete_free(C, op);
+ ED_undo_push(C, op->type->name);
return OPERATOR_FINISHED;
}
else {
@@ -315,8 +319,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
(void)text;
- TextUndoBuf *utxt = NULL; // FIXME
-
if (st->doplugins && texttool_text_is_active(st->text)) {
if (texttool_suggest_first()) tools |= TOOL_SUGG_LIST;
if (texttool_docs_get()) tools |= TOOL_DOCUMENT;
@@ -343,8 +345,10 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
case MIDDLEMOUSE:
if (event->val == KM_PRESS) {
if (text_do_suggest_select(st, ar)) {
+ TextUndoBuf *utxt = ED_text_undo_push_init(C);
confirm_suggestion(st->text, utxt);
text_update_line_edited(st->text->curl);
+ ED_undo_push(C, op->type->name);
swallow = 1;
}
else {
@@ -378,8 +382,10 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
case PADENTER:
if (event->val == KM_PRESS) {
if (tools & TOOL_SUGG_LIST) {
+ TextUndoBuf *utxt = ED_text_undo_push_init(C);
confirm_suggestion(st->text, utxt);
text_update_line_edited(st->text->curl);
+ ED_undo_push(C, op->type->name);
swallow = 1;
draw = 1;
}
@@ -591,5 +597,6 @@ void TEXT_OT_autocomplete(wmOperatorType *ot)
ot->poll = text_space_edit_poll;
/* flags */
+ /* Undo is handled conditionally by this operator. */
ot->flag = OPTYPE_BLOCKING;
}