diff options
author | Justin Dailey <dail8859@yahoo.com> | 2012-12-01 02:46:28 +0400 |
---|---|---|
committer | Justin Dailey <dail8859@yahoo.com> | 2012-12-01 02:46:28 +0400 |
commit | 40e76df0db2751aedf6d5b8387e167492b662482 (patch) | |
tree | 92dd8f370dbd2b20e61dcfb3bfbf46a427e82235 /source/blender | |
parent | 75cce01a614e686530e26dbd186a88d75dc4e7b5 (diff) |
fix [#33363] Text editor undo fail
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index e6339d07e66..322b77e0462 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2019,8 +2019,14 @@ void txt_do_undo(Text *text) /* get and restore the cursors */ txt_undo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc); + txt_move_to(text, curln, curc, 0); - txt_move_to(text, curln, curc + linep, 1); + txt_move_to(text, selln, selc, 1); + + if ((curln == selln) && (curc == selc)) { + for (i = 0; i < linep; i++) + txt_move_right(text, 1); + } txt_delete_selected(text); @@ -2269,6 +2275,8 @@ void txt_split_curline(Text *text) txt_delete_sel(text); + if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n'); + /* Make the two half strings */ left = MEM_mallocN(text->curc + 1, "textline_string"); @@ -2300,7 +2308,6 @@ void txt_split_curline(Text *text) txt_clean_text(text); txt_pop_sel(text); - if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n'); } static void txt_delete_line(Text *text, TextLine *line) |