menu poc: let menu handle section shortcuts #1058

This commit is contained in:
nick black 2020-10-15 07:40:53 -04:00 committed by Nick Black
parent a1a4087ca7
commit 0e294626ab

View File

@ -32,29 +32,7 @@ run_menu(struct notcurses* nc, struct ncmenu* ncm){
notcurses_render(nc);
while((keypress = notcurses_getc_blocking(nc, &ni)) != (char32_t)-1){
if(!ncmenu_offer_input(ncm, &ni)){
if(keypress == '\x1b'){
if(ncmenu_rollup(ncm)){
goto err;
}
}else if(ni.alt){
switch(keypress){
case 'a': case 'A': case 0x00e4:
if(ncmenu_unroll(ncm, 0)){
goto err;
}
break;
case 'f': case 'F':
if(ncmenu_unroll(ncm, 1)){
goto err;
}
break;
case 'h': case 'H':
if(ncmenu_unroll(ncm, 3)){
goto err;
}
break;
}
}else if(keypress == 'q'){
if(keypress == 'q'){
ncmenu_destroy(ncm);
ncplane_destroy(selplane);
return 0;