diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-07-11 08:25:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-07-17 14:19:22 +0300 |
commit | 366865dd020904116086e6d9ec46b8f70c42cdd1 (patch) | |
tree | 3e6cc12c3bf5a64c2ee36378817f0ff0afbdadcc /source/blender/editors/space_text/text_autocomplete.c | |
parent | 9e9fbb39d7f9e0a63c71fbc96237ace62fae0db6 (diff) |
Undo System: replace with simpler binary diffing buffer storage
Applying/undoing incremental changes didn't fit well when
mixed with periodic snapshots from mem-file undo.
This moves to a much simpler undo system.
- Uses array storage with de-duplication from `BLI_array_store`.
- Loads the buffer into existing text data,
for better performance on large files.
- Has the advantage that Python operators can be supported
since we don't depend on hard coded undo operations.
Solves T67045, T66695, T65909.
Diffstat (limited to 'source/blender/editors/space_text/text_autocomplete.c')
-rw-r--r-- | source/blender/editors/space_text/text_autocomplete.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index c36175489b3..b6c660ae5b2 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -260,7 +260,7 @@ static void get_suggest_prefix(Text *text, int offset) texttool_suggest_prefix(line + i, len); } -static void confirm_suggestion(Text *text, TextUndoBuf *utxt) +static void confirm_suggestion(Text *text) { SuggItem *sel; int i, over = 0; @@ -285,7 +285,7 @@ static void confirm_suggestion(Text *text, TextUndoBuf *utxt) // for (i = 0; i < skipleft; i++) // txt_move_left(text, 0); BLI_assert(memcmp(sel->name, &line[i], over) == 0); - txt_insert_buf(text, utxt, sel->name + over); + txt_insert_buf(text, sel->name + over); // for (i = 0; i < skipleft; i++) // txt_move_right(text, 0); @@ -308,8 +308,8 @@ 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 = ED_text_undo_push_init(C); - confirm_suggestion(st->text, utxt); + ED_text_undo_push_init(C); + confirm_suggestion(st->text); text_update_line_edited(st->text->curl); text_autocomplete_free(C, op); ED_undo_push(C, op->type->name); @@ -371,8 +371,8 @@ 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); + ED_text_undo_push_init(C); + confirm_suggestion(st->text); text_update_line_edited(st->text->curl); ED_undo_push(C, op->type->name); swallow = 1; @@ -410,8 +410,8 @@ 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); + ED_text_undo_push_init(C); + confirm_suggestion(st->text); text_update_line_edited(st->text->curl); ED_undo_push(C, op->type->name); swallow = 1; |