]> granicus.if.org Git - nethack/commitdiff
Win32GUI: Prevent ampersand-escaped mnemonics in menus
authorPasi Kallinen <paxed@alt.org>
Mon, 18 Sep 2017 12:30:52 +0000 (15:30 +0300)
committerPasi Kallinen <paxed@alt.org>
Mon, 18 Sep 2017 12:30:52 +0000 (15:30 +0300)
win/win32/mhmenu.c

index 9d9e17a1f1ad0b689323aa9492dcf023f2d82a68..bbf364cd4cd3b9ceae92df52765adb89f0357637 100644 (file)
@@ -603,6 +603,8 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
         data->menu.items[new_item].attr = msg_data->attr;
         strncpy(data->menu.items[new_item].str, msg_data->str,
                 NHMENU_STR_SIZE);
+       /* prevent & being interpreted as a mnemonic start */
+        strNsubst(data->menu.items[new_item].str, "&", "&&", 0);
         data->menu.items[new_item].presel = msg_data->presel;
 
         /* calculate tabstop size */