Do not allow disabled items to be selected.

pull/2448/head
nicm 2020-10-30 12:00:01 +00:00
parent 8e1d28453d
commit 9726c4454e
1 changed files with 4 additions and 3 deletions

7
menu.c
View File

@ -315,10 +315,11 @@ chosen:
if (md->choice == -1)
return (1);
item = &menu->items[md->choice];
if ((md->flags & MENU_STAYOPEN) && item->name == NULL)
return (0);
if (item->name == NULL || *item->name == '-')
if (item->name == NULL || *item->name == '-') {
if (md->flags & MENU_STAYOPEN)
return (0);
return (1);
}
if (md->cb != NULL) {
md->cb(md->menu, md->choice, item->key, md->data);
md->cb = NULL;