]> granicus.if.org Git - nethack/commitdiff
Qt info->annotate
authorPatR <rankin@nethack.org>
Tue, 11 Aug 2020 01:11:12 +0000 (18:11 -0700)
committerPatR <rankin@nethack.org>
Tue, 11 Aug 2020 01:11:12 +0000 (18:11 -0700)
The core is mapping #annotate to ^N, which has no effect when
number_pad is Off.  The Qt menu setup saw it as the way to run
that command, which will only work when number_pad is On.  This
fixes the menu and didn't break the large subset of other menu
commands I've tried, but I haven't gotten through half of them yet.

win/Qt/qt_main.cpp

index 32c791a029521dc334ed81c788c66d6e9b307464..6fc39047e9ade9c13e6260417796a8be4983d691 100644 (file)
@@ -702,8 +702,16 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) :
                 actchar[0] = actchar[1] = '\0';
                 if (item[i].funct) {
                     actchar[0] = cmd_from_func(item[i].funct);
-                    /* M-c won't work */
-                    if ((actchar[0] & 0x7f) != actchar[0])
+                    if (actchar[0]
+                        /* M-c won't work; translation between character
+                           sets by the QString class can classify such
+                           characters as erroneous and change them to '?' */
+                        && ((actchar[0] & 0x7f) != actchar[0]
+                        /* the vi movement keys won't work reliably
+                           because toggling number_pad affects them but
+                           doesn't redo these menus */
+                            || strchr("hjklyubnHJKLYUBN", actchar[0])
+                            || strchr("hjklyubn", (actchar[0] | 0x60))))
                         actchar[0] = '\0';
                 }
                 if (actchar[0] && !qt_compact_mode)