[Bf-blender-cvs] [771973869d2] blender2.8: Fix assert in UI string trimming code when we have 'protected' right part.

Bastien Montagne noreply at git.blender.org
Thu Aug 2 16:39:35 CEST 2018


Commit: 771973869d293f188687ffa88572e1c4e9946aae
Author: Bastien Montagne
Date:   Thu Aug 2 16:38:39 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB771973869d293f188687ffa88572e1c4e9946aae

Fix assert in UI string trimming code when we have 'protected' right part.

===================================================================

M	source/blender/editors/interface/interface_widgets.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list