diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-04-15 10:36:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-04-15 10:36:34 +0300 |
commit | 530008df1d1cbc0318bbaa9c1a3a3908466d19c6 (patch) | |
tree | 782f283bffc75a4ed4d7d5207c5431b204ee7156 /source/blender/editors/interface/interface_region_menu_popup.c | |
parent | e17bee5b7f71af2e170ac692427ff509a55f7ecf (diff) |
Fix incorrect UI_SEP_CHAR checks
- Menu drawing function used first instance instead of last.
- Menu hash function checked for the character without first
checking UI_BUT_HAS_SEP_CHAR was enabled.
Diffstat (limited to 'source/blender/editors/interface/interface_region_menu_popup.c')
-rw-r--r-- | source/blender/editors/interface/interface_region_menu_popup.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index a161a449ba0..31ef7261eb3 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -88,11 +88,11 @@ int ui_but_menu_step(uiBut *but, int direction) return 0; } -static uint ui_popup_string_hash(const char *str) +static uint ui_popup_string_hash(const char *str, const bool use_sep) { /* sometimes button contains hotkey, sometimes not, strip for proper compare */ int hash; - const char *delimit = strrchr(str, UI_SEP_CHAR); + const char *delimit = use_sep ? strrchr(str, UI_SEP_CHAR) : NULL; if (delimit) { hash = BLI_ghashutil_strhash_n(str, delimit - str); @@ -126,13 +126,13 @@ static uiBut *ui_popup_menu_memory__internal(uiBlock *block, uiBut *but) if (but) { /* set */ - mem[hash_mod] = ui_popup_string_hash(but->str); + mem[hash_mod] = ui_popup_string_hash(but->str, but->flag & UI_BUT_HAS_SEP_CHAR); return NULL; } else { /* get */ for (but = block->buttons.first; but; but = but->next) { - if (ui_popup_string_hash(but->str) == mem[hash_mod]) { + if (mem[hash_mod] == ui_popup_string_hash(but->str, but->flag & UI_BUT_HAS_SEP_CHAR)) { return but; } } |