diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-08-02 17:38:39 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-08-02 17:39:15 +0300 |
commit | 771973869d293f188687ffa88572e1c4e9946aae (patch) | |
tree | e488fa1a5c89f889f8dc7b9edefdd1512cf1c059 /source/blender/editors/interface | |
parent | 777e1b9654ca50af5e52052c05f6ca556e46ba9c (diff) |
Fix assert in UI string trimming code when we have 'protected' right part.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d0cdba49536..019aabdb466 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1494,7 +1494,7 @@ float UI_text_clip_middle_ex( rpart = rpart_buf; } - l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, parts_strwidth, &rpart_width); + l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, parts_strwidth, NULL); if (l_end < 10 || min_ff(parts_strwidth, strwidth - okwidth) < minwidth) { /* If we really have no place, or we would clip a very small piece of string in the middle, * only show start of string. @@ -1504,7 +1504,7 @@ float UI_text_clip_middle_ex( else { size_t r_offset, r_len; - r_offset = BLF_width_to_rstrlen(fstyle->uifont_id, str, max_len, parts_strwidth, &rpart_width); + r_offset = BLF_width_to_rstrlen(fstyle->uifont_id, str, max_len, parts_strwidth, NULL); r_len = strlen(str + r_offset) + 1; /* +1 for the trailing '\0'. */ if (l_end + sep_len + r_len + rpart_len > max_len) { @@ -1525,6 +1525,7 @@ float UI_text_clip_middle_ex( if (rpart) { /* Add back preserved right part to our shorten str. */ memcpy(str + final_lpart_len, rpart, rpart_len + 1); /* +1 for trailing '\0'. */ + okwidth += rpart_width; } strwidth = BLF_width(fstyle->uifont_id, str, max_len); |