Fix two bugs with searchbox UI items.
First one, reported by Sergey, was searchbox not closing when validating it (enter or LMB click) without any active item (we need to enable escapecancel here, to close menu too). Second one was SEARCH_MENU_UNLINK variant not unlinking at validation when no active item. Thanks a bunch to Campbell for help here!
This commit is contained in:
parent
1811ffff5d
commit
965205d0e2
|
@ -2491,6 +2491,9 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
|
|||
(ui_searchbox_find_index(data->searchbox, but->editstr) == -1))
|
||||
{
|
||||
data->cancel = true;
|
||||
|
||||
/* ensure menu (popup) too is closed! */
|
||||
data->escapecancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -888,6 +888,12 @@ bool ui_searchbox_apply(uiBut *but, ARegion *ar)
|
|||
|
||||
return true;
|
||||
}
|
||||
else if (but->type == SEARCH_MENU_UNLINK) {
|
||||
/* It is valid for _UNLINK flavor to have no active element (it's a valid way to unlink). */
|
||||
but->editstr[0] = '\0';
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue