]> granicus.if.org Git - nethack/commitdiff
win32-gui: Do not auto-assign non-alphabet accelerator characters to menu items....
authorAlex Kompel <barbos+droidzebra@gmail.com>
Sun, 18 Mar 2018 19:52:30 +0000 (12:52 -0700)
committerAlex Kompel <barbos+nethack@gmail.com>
Mon, 19 Mar 2018 06:00:16 +0000 (23:00 -0700)
win/win32/mhmenu.c

index 6bdea0a2f2c7d65f3625f0ca5a7cc61f1164ba46..b541af3056bfbe52b6a396e0850234e69103c549 100644 (file)
@@ -160,10 +160,11 @@ mswin_menu_window_select_menu(HWND hWnd, int how, MENU_ITEM_P **_selected,
         ap = data->menu.gacc;
         for (i = 0; i < data->menu.size; i++) {
             if (data->menu.items[i].accelerator != 0) {
-                next_char = (char) (data->menu.items[i].accelerator + 1);
+                if (isalpha(data->menu.items[i].accelerator)) {
+                    next_char = (char)(data->menu.items[i].accelerator + 1);
+                }
             } else if (NHMENU_IS_SELECTABLE(data->menu.items[i])) {
-                if ((next_char >= 'a' && next_char <= 'z')
-                    || (next_char >= 'A' && next_char <= 'Z')) {
+                if (isalpha(next_char)) {
                     data->menu.items[i].accelerator = next_char;
                 } else {
                     if (next_char > 'z')