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:
Bastien Montagne 2014-09-10 12:53:22 +02:00
parent 1811ffff5d
commit 965205d0e2
2 changed files with 9 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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;
}