diff options
author | Justin Dailey <dail8859@yahoo.com> | 2013-09-06 01:36:19 +0400 |
---|---|---|
committer | Justin Dailey <dail8859@yahoo.com> | 2013-09-06 01:36:19 +0400 |
commit | 89a02fc4ef775d7933032b2a00ed8ebcca0d8b6d (patch) | |
tree | b3eb9cdb2cbaf0eb248930eb82028b06445966f7 /source | |
parent | 3b72f1824cf06216c70101ee0d29004cc6dc632d (diff) |
fix [#36656] text editor undo error when undoing paste command
When tabs to spaces is enabled and a paste command is undone, the improper number of characters could get removed. Also fixed issue with shift + left/right only selecting a max of 1 character.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 750f328e7e7..be43aae1ed3 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1947,6 +1947,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s void txt_do_undo(Text *text) { int op = text->undo_buf[text->undo_pos]; + int prev_flags; unsigned int linep, i; unsigned int uchar; unsigned int curln, selln; @@ -2070,8 +2071,14 @@ void txt_do_undo(Text *text) txt_move_to(text, selln, selc, 1); if ((curln == selln) && (curc == selc)) { + /* disable tabs to spaces since moving right may involve skipping multiple spaces */ + prev_flags = text->flags; + text->flags &= ~TXT_TABSTOSPACES; + for (i = 0; i < linep; i++) txt_move_right(text, 1); + + text->flags = prev_flags; } txt_delete_selected(text); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 0baec4d030c..2c2a8b255da 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1861,7 +1861,7 @@ static int text_move_cursor(bContext *C, int type, int select) break; case PREV_CHAR: - if (txt_has_sel(text)) { + if (txt_has_sel(text) && !select) { txt_order_cursors(text, false); txt_pop_sel(text); } @@ -1871,7 +1871,7 @@ static int text_move_cursor(bContext *C, int type, int select) break; case NEXT_CHAR: - if (txt_has_sel(text)) { + if (txt_has_sel(text) && !select) { txt_order_cursors(text, true); txt_pop_sel(text); } |