[Bf-blender-cvs] [5279593] master: Fix for RMB Menu title including shortcut

Campbell Barton noreply at git.blender.org
Wed Jun 3 07:09:21 CEST 2015


Commit: 52795932a7f7890a32e22605594f79f3351a892d
Author: Campbell Barton
Date:   Wed Jun 3 14:57:14 2015 +1000
Branches: master
https://developer.blender.org/rB52795932a7f7890a32e22605594f79f3351a892d

Fix for RMB Menu title including shortcut

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

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

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

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4a48c9a..e045db8 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -4457,7 +4457,19 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
 
 		if (type == BUT_GET_LABEL) {
 			if (but->str) {
-				tmp = BLI_strdup(but->str);
+				const char *str_sep;
+				size_t str_len;
+
+				if ((but->flag & UI_BUT_HAS_SEP_CHAR) &&
+				    (str_sep = strrchr(but->str, UI_SEP_CHAR)))
+				{
+					str_len = (str_sep - but->str);
+				}
+				else {
+					str_len = strlen(but->str);
+				}
+
+				tmp = BLI_strdupn(but->str, str_len);
 			}
 			else {
 				type = BUT_GET_RNA_LABEL;  /* Fail-safe solution... */




More information about the Bf-blender-cvs mailing list