menu PoC: implement quit item

pull/1136/head
nick black 4 years ago
parent a7c7b8ff0b
commit 7c249bf9b9
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -34,6 +34,15 @@ run_menu(struct notcurses* nc, struct ncmenu* ncm){
ncmenu_destroy(ncm);
ncplane_destroy(selplane);
return 0;
}else if(keypress == NCKEY_ENTER){ // selected a menu item
const char* sel;
if( (sel = ncmenu_selected(ncm, &ni)) ){
if(strcmp(sel, "Quit") == 0){
ncmenu_destroy(ncm);
ncplane_destroy(selplane);
return 0;
}
}
}
}
ncplane_erase(selplane);
@ -71,7 +80,7 @@ int main(void){
{ .desc = "Open", .shortcut = { .id = 'o', .ctrl = true, }, },
{ .desc = "Close", .shortcut = { .id = 'c', .ctrl = true, }, },
{ .desc = NULL, },
{ .desc = "Quit", .shortcut = { .id = 'q', .ctrl = true, }, },
{ .desc = "Quit", .shortcut = { .id = 'q', }, },
};
struct ncmenu_item help_items[] = {
{ .desc = "About", .shortcut = { .id = 'a', .ctrl = true, }, },

Loading…
Cancel
Save