diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 07:03:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 07:03:12 +0400 |
commit | ab7ca2dc441239686bcc44189c79e377ba4d089c (patch) | |
tree | 21d2ff9ffcb561e420c47ade3450394c93713320 /source/blender/blenlib/intern/string_cursor_utf8.c | |
parent | 12f6d3ad906924ff8a2bbae7eadae3e28ab62d83 (diff) |
fix for double clicking in the text editor not working usefully (double clicking a pair chars would select 3 - one to the left).
Diffstat (limited to 'source/blender/blenlib/intern/string_cursor_utf8.c')
-rw-r--r-- | source/blender/blenlib/intern/string_cursor_utf8.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c index 65763f21b0f..b8797855f17 100644 --- a/source/blender/blenlib/intern/string_cursor_utf8.c +++ b/source/blender/blenlib/intern/string_cursor_utf8.c @@ -139,12 +139,15 @@ int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *p void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, int *pos, strCursorJumpDirection direction, - strCursorJumpType jump) + strCursorJumpType jump, bool use_init_step) { const int pos_prev = *pos; if (direction == STRCUR_DIR_NEXT) { - BLI_str_cursor_step_next_utf8(str, maxlen, pos); + if (use_init_step) { + BLI_assert(jump == STRCUR_JUMP_DELIM); + BLI_str_cursor_step_next_utf8(str, maxlen, pos); + } if (jump != STRCUR_JUMP_NONE) { const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type(&str[*pos]) : STRCUR_DELIM_NONE; @@ -163,7 +166,10 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, } } else if (direction == STRCUR_DIR_PREV) { - BLI_str_cursor_step_prev_utf8(str, maxlen, pos); + if (use_init_step) { + BLI_assert(jump == STRCUR_JUMP_DELIM); + BLI_str_cursor_step_prev_utf8(str, maxlen, pos); + } if (jump != STRCUR_JUMP_NONE) { const strCursorDelimType delim_type = (*pos) > 1 ? cursor_delim_type(&str[(*pos) - 1]) : STRCUR_DELIM_NONE; |