[syslinux] Fix: hotkey uppercasing too wide

Dany St-Amant dany.ephemeral.2014 at icloud.com
Wed Apr 17 12:35:58 PDT 2019


Hello,

 Stumble upon this issue. If one define digits as hotkeys, the action is also taken for the non-reserved CTRL-P to CTRL-Y (also affect ASCII prior to digits). Here's a quick patch, quickly tested for action on uppercase/lowercase and digit and inaction on "matching" CTRL key.

Regards,
Dany

*Sample config section*
LABEL extra2
  MENU LABEL ^2. Two
  # pressing 2 activates this entry
  # pressing CTRL-R activates this entry (prior to fix below)
LABEL extradollar
  MENU LABEL ^$. Dollar
  # pressing $ activates this entry
  # pressing CTRL-D activates this entry (prior to fix below)

*Patch*
# Sorry for the crypto one-liners
--- syslinux-6.03/com32/menu/menumain.c.orig	2014-10-06 11:27:44.000000000 -0500
+++ syslinux-6.03/com32/menu/menumain.c	2019-04-17 12:11:41.677824723 -0500
@@ -1081,7 +1081,7 @@ static const char *run_menu(void)
 	    break;
 	default:
 	    if (key > 0 && key < 0xFF) {
-		key &= ~0x20;	/* Upper case */
+		key &= ((key & 0xE0) == 0x60 ? ~0x20 : 0xFF);	/* Upper case */
 		if (cm->menu_hotkeys[key]) {
 		    key_timeout = 0;
 		    entry = cm->menu_hotkeys[key]->entry;
--- syslinux-6.03/com32/menu/readconfig.c.orig	2019-04-17 11:53:15.794263379 -0500
+++ syslinux-6.03/com32/menu/readconfig.c	2019-04-17 12:13:43.549878848 -0500
@@ -279,7 +279,7 @@ static void consider_for_hotkey(struct m
 
     if (me->action != MA_DISABLED) {
 	if (p && p[1]) {
-	    unsigned char hotkey = p[1] & ~0x20;
+	    unsigned char hotkey = p[1] & ((hotkey & 0xE0) == 0x60 ? ~0x20 : 0xFF);
 	    if (!m->menu_hotkeys[hotkey]) {
 		me->hotkey = hotkey;
 		m->menu_hotkeys[hotkey] = me;

*Patch limitation*
Six non-letters are still mapped to "uppercase":
 ' -> @
 { -> [
 | -> \
 } -> ]
 ~ -> ^
DEL -> _





More information about the Syslinux mailing list