summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-10-12 12:59:32 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-10-12 13:20:27 +0100
commitac3f053411c096dea192e9572c7cb3abc32d8b6e (patch)
treeb78b41840fedfe68d1c73a940ec504fba4b0b196
parent592a8fe37795c760b1b724f9771e5f0f3d7d3706 (diff)
downloadsyslinux-ac3f053411c096dea192e9572c7cb3abc32d8b6e.tar.gz
menu: Disallow navigation to a disabled entry via *any* key
Generalise the fix from commit c823574f53c1 ("menu: Don't highlight disabled entries") as it only handled the case where we navigated to a disabled last entry by pressing Ctrl + N or the DOWN arrow key. Obviously, we can navigate with other keys such as END, PGDN, etc so we need to handle all cases. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/menu/menumain.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index 7c589797..8573901c 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -806,7 +806,7 @@ static const char *run_menu(void)
while (entry < cm->nentries && is_disabled(cm->menu_entries[entry]))
entry++;
}
- if (entry >= cm->nentries) {
+ if (entry >= cm->nentries - 1) {
entry = cm->nentries - 1;
while (entry > 0 && is_disabled(cm->menu_entries[entry]))
entry--;
@@ -958,7 +958,8 @@ static const char *run_menu(void)
case KEY_DOWN:
case KEY_CTRL('N'):
- while (++entry < cm->nentries) {
+ while (entry < cm->nentries - 1) {
+ entry++;
if (entry >= top + MENU_ROWS)
top += MENU_ROWS;
if (!is_disabled(cm->menu_entries[entry]))