]> granicus.if.org Git - nethack/commitdiff
tty logic error using menuitem_invert_test()
authorPatR <rankin@nethack.org>
Sat, 2 Apr 2022 08:00:09 +0000 (01:00 -0700)
committerPatR <rankin@nethack.org>
Sat, 2 Apr 2022 08:00:09 +0000 (01:00 -0700)
menuitem_invert_test() is intended for invert-all/invert-page/
select-all/select-page but was being called for group accelerators.
In the #wizidentify menu, the 'all' choice specifies ^I as a group
accelerator but that stopped working on tty when it recently became
flagged as skip-invert.

doc/fixes3-7-0.txt
win/tty/wintty.c

index 20c3996350fc15947e173a6205a1bbe868b5f2f3..a40a6408b32f36f9216e01e616261ff070d55633 100644 (file)
@@ -1150,6 +1150,9 @@ tty: redraw unexplored locations as S_unexplored rather than <space> after
        map has been partially overwritten by popup menu or text display
 tty: previous change resulted in remnants of previous level being shown on
        new level after level change when S_unexplored is <space>
+tty: for #wizidentify, using ^I as an unseen group accelerator to pick the
+       'all' choice was incorrectly checking menuitem_invert_test() and
+       failing, so the 'all' choice wasn't being toggled on if user typed ^I
 Unix: after lua changes to Makefiles, 'make spotless' for dat subdirectory
        left some generated data files which should have been deleted
 Windows: new tile additions in win/share did not trigger the creation of a new
index 594f9985b7a8bd1e02f56f5eccc2f9655e3fd9d4..291af4e502d38a87b65149544d3cfea28f115be5 100644 (file)
@@ -74,7 +74,7 @@ extern void msmsg(const char *, ...);
  */
 #define HUPSKIP() \
     do {                                        \
-        if (g.program_state.done_hup) {           \
+        if (g.program_state.done_hup) {         \
             morc = '\033';                      \
             return;                             \
         }                                       \
@@ -82,7 +82,7 @@ extern void msmsg(const char *, ...);
     /* morc=ESC - in case we bypass xwaitforspace() which sets that */
 #define HUPSKIP_RESULT(RES) \
     do {                                        \
-        if (g.program_state.done_hup)             \
+        if (g.program_state.done_hup)           \
             return (RES);                       \
     } while (0)
 #else /* !HANGUP_HANDLING */
@@ -1821,8 +1821,9 @@ invert_all_on_page(
 
     for (n = 0, curr = page_start; curr != page_end; n++, curr = curr->next) {
         if (!curr->identifier.a_void /* not selectable */
-            || (acc != 0 && curr->gselector != acc) /* not group 'acc' */
-            || !menuitem_invert_test(0, curr->itemflags, curr->selected))
+            || (acc ? curr->gselector != acc /* skip if not group 'acc' */
+                /* inverting all rather than a group; skip if flagged */
+                : !menuitem_invert_test(0, curr->itemflags, curr->selected)))
             continue;
 
         if (curr->selected) {
@@ -1867,8 +1868,8 @@ invert_all(
            limits to bulk toggling (assumes that an item won't be
            both in a group and also subject to bulk restrictions) */
         if (on_curr_page || !curr->identifier.a_void
-            || (acc != 0 && curr->gselector != acc)
-            || !menuitem_invert_test(0, curr->itemflags, curr->selected))
+            || (acc ? curr->gselector != acc
+                : !menuitem_invert_test(0, curr->itemflags, curr->selected)))
             continue;
 
         if (curr->selected) {