diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-09-27 18:39:24 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-09-27 18:40:36 +0300 |
commit | 12fdf9069abe3cd2250a9efec6e059eb85ec59d8 (patch) | |
tree | a937501d90a2fd99e5ec63d4d99e6337fc4067ea /source/blender/editors | |
parent | 697e86a76199c66267370f0222932b8fcb30dc3d (diff) |
BLF: Editing Text with Combining Characters
Corrections for caret insertion & movement and deletion for text
strings that include non-precomposed diacritical marks (Unicode
combining characters).
See D15659 for more details and examples.
Differential Revision: https://developer.blender.org/D15659
Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/curve/editfont.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 03c485a7671..8adc5173e22 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1160,14 +1160,13 @@ static int move_cursor(bContext *C, int type, const bool select) } case PREV_CHAR: - ef->pos--; + BLI_str_cursor_step_prev_utf32(ef->textbuf, ef->len, &ef->pos); cursmove = FO_CURS; break; case NEXT_CHAR: - ef->pos++; + BLI_str_cursor_step_next_utf32(ef->textbuf, ef->len, &ef->pos); cursmove = FO_CURS; - break; case PREV_LINE: @@ -1506,10 +1505,9 @@ static int delete_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - range[0] = ef->pos - 1; range[1] = ef->pos; - - ef->pos--; + BLI_str_cursor_step_prev_utf32(ef->textbuf, ef->len, &ef->pos); + range[0] = ef->pos; break; case DEL_NEXT_CHAR: if (ef->pos >= ef->len) { @@ -1517,7 +1515,8 @@ static int delete_exec(bContext *C, wmOperator *op) } range[0] = ef->pos; - range[1] = ef->pos + 1; + range[1] = ef->pos; + BLI_str_cursor_step_next_utf32(ef->textbuf, ef->len, &range[1]); break; case DEL_NEXT_WORD: { int pos = ef->pos; |