diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-02 04:47:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-02 04:47:27 +0400 |
commit | 26cbf331a858db0ac49e2de8b60ae7710a8c7c66 (patch) | |
tree | 474cf2531643215c547dd740c40f1839b8517dd1 /source/blender/editors/space_text/text_ops.c | |
parent | 75a2b5ee3574a5c7654270cf5d55cee96251933d (diff) |
text editor cursor motion (left/right arrows) with selected text typically jumps to either side of the selection previously the cursor would move and loose the selection too.
text button fields already did this.
Diffstat (limited to 'source/blender/editors/space_text/text_ops.c')
-rw-r--r-- | source/blender/editors/space_text/text_ops.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 410abec706b..0baec4d030c 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -949,7 +949,7 @@ static int text_indent_exec(bContext *C, wmOperator *UNUSED(op)) text_drawcache_tag_update(CTX_wm_space_text(C), 0); if (txt_has_sel(text)) { - txt_order_cursors(text); + txt_order_cursors(text, false); txt_indent(text); } else @@ -983,7 +983,7 @@ static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op)) text_drawcache_tag_update(CTX_wm_space_text(C), 0); - txt_order_cursors(text); + txt_order_cursors(text, false); txt_unindent(text); text_update_edited(text); @@ -1063,7 +1063,7 @@ static int text_comment_exec(bContext *C, wmOperator *UNUSED(op)) if (txt_has_sel(text)) { text_drawcache_tag_update(CTX_wm_space_text(C), 0); - txt_order_cursors(text); + txt_order_cursors(text, false); txt_comment(text); text_update_edited(text); @@ -1096,7 +1096,7 @@ static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op)) if (txt_has_sel(text)) { text_drawcache_tag_update(CTX_wm_space_text(C), 0); - txt_order_cursors(text); + txt_order_cursors(text, false); txt_uncomment(text); text_update_edited(text); @@ -1861,11 +1861,23 @@ static int text_move_cursor(bContext *C, int type, int select) break; case PREV_CHAR: - txt_move_left(text, select); + if (txt_has_sel(text)) { + txt_order_cursors(text, false); + txt_pop_sel(text); + } + else { + txt_move_left(text, select); + } break; case NEXT_CHAR: - txt_move_right(text, select); + if (txt_has_sel(text)) { + txt_order_cursors(text, true); + txt_pop_sel(text); + } + else { + txt_move_right(text, select); + } break; case PREV_LINE: |