From a1a4087ca7474fd43d9a8568cda4db9aa4c681a9 Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 15 Oct 2020 07:40:40 -0400 Subject: [PATCH] ncmenu: handle section shortcuts when offered #1058 --- src/lib/menu.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib/menu.c b/src/lib/menu.c index b49cca9dc..8da052425 100644 --- a/src/lib/menu.c +++ b/src/lib/menu.c @@ -586,7 +586,19 @@ bool ncmenu_offer_input(ncmenu* n, const ncinput* nc){ ncmenu_unroll(n, i); } return true; - }else if(n->unrolledsection < 0){ // all following need an unrolled section + } + for(int si = 0 ; si < n->sectioncount ; ++si){ + const ncmenu_int_section* sec = &n->sections[si]; + if(sec->enabled_item_count == 0){ + continue; + } + if(!ncinput_equal_p(&sec->shortcut, nc)){ + continue; + } + ncmenu_unroll(n, si); + return true; + } + if(n->unrolledsection < 0){ // all following need an unrolled section return false; } if(nc->id == NCKEY_LEFT){