diff options
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_undo.c | 15 |
2 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 63d4f3e3119..33bacb0a95f 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -932,7 +932,7 @@ static void txt_copy_clipboard(Text *text) return; } - buf = txt_sel_to_buf(text); + buf = txt_sel_to_buf(text, NULL); if (buf) { WM_clipboard_text_set(buf, 0); @@ -2994,7 +2994,7 @@ static void text_cursor_set_exit(bContext *C, wmOperator *op) char *buffer; if (txt_has_sel(text)) { - buffer = txt_sel_to_buf(text); + buffer = txt_sel_to_buf(text, NULL); WM_clipboard_text_set(buffer, 1); MEM_freeN(buffer); } @@ -3308,7 +3308,7 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode) /* Replace current */ if (mode != TEXT_FIND && txt_has_sel(text)) { - tmp = txt_sel_to_buf(text); + tmp = txt_sel_to_buf(text, NULL); if (flags & ST_MATCH_CASE) { found = STREQ(st->findstr, tmp); @@ -3406,7 +3406,7 @@ static int text_find_set_selected_exec(bContext *C, wmOperator *op) Text *text = CTX_data_edit_text(C); char *tmp; - tmp = txt_sel_to_buf(text); + tmp = txt_sel_to_buf(text, NULL); BLI_strncpy(st->findstr, tmp, ST_MAX_FIND_STR); MEM_freeN(tmp); @@ -3437,7 +3437,7 @@ static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op)) Text *text = CTX_data_edit_text(C); char *tmp; - tmp = txt_sel_to_buf(text); + tmp = txt_sel_to_buf(text, NULL); BLI_strncpy(st->replacestr, tmp, ST_MAX_FIND_STR); MEM_freeN(tmp); diff --git a/source/blender/editors/space_text/text_undo.c b/source/blender/editors/space_text/text_undo.c index 7710c5637a2..66cbaa8bb5b 100644 --- a/source/blender/editors/space_text/text_undo.c +++ b/source/blender/editors/space_text/text_undo.c @@ -130,7 +130,7 @@ static void text_undosys_step_decode_redo_impl(Text *text, TextUndoStep *us) us->step.is_applied = true; } -static void text_undosys_step_decode_undo(TextUndoStep *us) +static void text_undosys_step_decode_undo(TextUndoStep *us, bool is_final) { TextUndoStep *us_iter = us; while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) { @@ -140,13 +140,16 @@ static void text_undosys_step_decode_undo(TextUndoStep *us) us_iter = (TextUndoStep *)us_iter->step.next; } Text *text_prev = NULL; - while (us_iter != us) { + while ((us_iter != us) || (is_final && us_iter == us)) { Text *text = us_iter->text_ref.ptr; text_undosys_step_decode_undo_impl(text, us_iter); if (text_prev != text) { text_update_edited(text); text_prev = text; } + if (is_final) { + break; + } us_iter = (TextUndoStep *)us_iter->step.prev; } } @@ -175,15 +178,13 @@ static void text_undosys_step_decode_redo(TextUndoStep *us) } } -static void text_undosys_step_decode(struct bContext *C, - struct Main *UNUSED(bmain), - UndoStep *us_p, - int dir) +static void text_undosys_step_decode( + struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir, bool is_final) { TextUndoStep *us = (TextUndoStep *)us_p; if (dir < 0) { - text_undosys_step_decode_undo(us); + text_undosys_step_decode_undo(us, is_final); } else { text_undosys_step_decode_redo(us); |