Fix (unreported) wrong 'use_sep' setting for menu items.

This option defines whether or not menu items drawing code must
separate drawstring in two, keeping right part at all cost.

This is used to show shortcuts of operators' enum entries usually.

Previous way to decide that was based on button having an RNA prop
pointer, assuming those without it were not 'data buttons' and hence
needed the shortcut special handling thingy.

That's wrong is many, many cases (especially since search templates
often generate more than one buttons, not all linked to actual RNA
data). So instead now checking whether a button has an optype set or
not, hopefully this will be much more accurate...

Other solution if thsi also fails, is to add new flag to buttons, and
explicitely set it when needed, instead of trying to guesstimate...
This commit is contained in:
Bastien Montagne 2018-10-11 17:36:37 +02:00
parent 4add09053c
commit cd23e89634
1 changed files with 3 additions and 2 deletions

View File

@ -533,8 +533,9 @@ ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but
data->prv_cols = but->a2;
}
/* only show key shortcuts when needed (not rna buttons) [#36699] */
if (but->rnaprop == NULL) {
/* Only show key shortcuts when needed (checking RNA prop pointer is useless here, a lot of buttons are about data
* without having that pointer defined, let's rather try with optype!). */
if (but->optype != NULL) {
data->use_sep = true;
}