[syslinux:master] menu: Disallow navigation to a disabled entry via *any* key

syslinux-bot for Matt Fleming matt.fleming at intel.com
Mon Oct 22 12:51:18 PDT 2012


Commit-ID:  ac3f053411c096dea192e9572c7cb3abc32d8b6e
Gitweb:     http://www.syslinux.org/commit/ac3f053411c096dea192e9572c7cb3abc32d8b6e
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Fri, 12 Oct 2012 12:59:32 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Fri, 12 Oct 2012 13:20:27 +0100

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 at hotmail.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/menu/menumain.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index 7c58979..8573901 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]))


More information about the Syslinux-commits mailing list