From: PatR Date: Sat, 2 Apr 2022 08:00:09 +0000 (-0700) Subject: tty logic error using menuitem_invert_test() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd355d6f6c70009e09fcef9e6c540dd973856856;p=nethack tty logic error using menuitem_invert_test() 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. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 20c399635..a40a6408b 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1150,6 +1150,9 @@ tty: redraw unexplored locations as S_unexplored rather than 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 +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 diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 594f9985b..291af4e50 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -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) {