]> granicus.if.org Git - nethack/commitdiff
menuinvertmode on curses
authorPatR <rankin@nethack.org>
Sat, 19 Mar 2022 19:49:43 +0000 (12:49 -0700)
committerPatR <rankin@nethack.org>
Sat, 19 Mar 2022 19:49:43 +0000 (12:49 -0700)
Change curses' use of menuitem_invert_test() to match the recently
changed tty behavior:  when menuinvertmode is 1 the test excludes
special menu items that are flagged 'skip-invert' while handling
select-all and select-page as well as invert-all and invert-page,
and when that option is 2 then it also operates on deselect-all and
deselect-page.

win/curses/cursdial.c

index 81e92a4652b8537e2f5a79923b353c5c94ebd7db..b448fc771893253821b2213fedf83e43eea6d795 100644 (file)
@@ -1703,9 +1703,10 @@ menu_operation(
         }
 
         if (menu_item_ptr->identifier.a_void != NULL) {
-            if (operation != INVERT
-                || menuitem_invert_test(0, menu_item_ptr->itemflags,
-                                        menu_item_ptr->selected))
+            if  (menuitem_invert_test(((operation == INVERT) ? 0
+                                       : (operation == SELECT) ? 1 : 2),
+                                      menu_item_ptr->itemflags,
+                                      menu_item_ptr->selected))
                 menu_select_deselect(win, menu_item_ptr,
                                      operation, current_page);
         }