diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-04-28 13:21:16 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-04-28 13:21:16 +0400 |
commit | 5a860b840ddfc208c11df5d6a621a8478514f113 (patch) | |
tree | 8e82d8b4a5e4f8e57eb2b8c5fbd6f63d3caad16f /source/blender | |
parent | 44924a2e5e10cf645e2a81e0041defa05b542e83 (diff) |
Fix: #31095: Incorrect clamping of labels for multibyte languages
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 03ceeb68c4c..4666232c232 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1047,9 +1047,8 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect) /* chop off the leading text, starting from the right */ while (but->strwidth > okwidth && cp2 > but->drawstr) { - int bytes = BLI_str_utf8_size(cp2); - if (bytes < 0) - bytes = 1; + char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, cp2); + int bytes = cp2 - prev_utf8; /* shift the text after and including cp2 back by 1 char, +1 to include null terminator */ memmove(cp2 - bytes, cp2, strlen(cp2) + 1); |