diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index c2ab91251b6..7f1f6590e48 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1888,8 +1888,9 @@ void txt_delete_char(Text *text) } } else { /* Just deleting a char */ - size_t c_len = 0; - c = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &c_len); + size_t c_len = text->curc; + c = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &c_len); + c_len -= text->curc; UNUSED_VARS(c); memmove(text->curl->line + text->curc, @@ -1937,9 +1938,11 @@ void txt_backspace_char(Text *text) txt_pop_sel(text); } else { /* Just backspacing a char */ - size_t c_len = 0; const char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc); - c = BLI_str_utf8_as_unicode_and_size(prev, &c_len); + size_t c_len = prev - text->curl->line; + c = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &c_len); + c_len -= prev - text->curl->line; + UNUSED_VARS(c); /* source and destination overlap, don't use memcpy() */ @@ -2053,7 +2056,9 @@ bool txt_replace_char(Text *text, unsigned int add) return txt_add_char(text, add); } - del = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &del_size); + del_size = text->curc; + del = BLI_str_utf8_as_unicode_step(text->curl->line, text->curl->len, &del_size); + del_size -= text->curc; UNUSED_VARS(del); add_size = BLI_str_utf8_from_unicode(add, ch); |