]> granicus.if.org Git - nethack/commitdiff
curses menu count entry
authorPatR <rankin@nethack.org>
Fri, 11 Feb 2022 20:10:20 +0000 (12:10 -0800)
committerPatR <rankin@nethack.org>
Fri, 11 Feb 2022 20:10:20 +0000 (12:10 -0800)
In a curses menu, if you type a digit to start a count, the cursor
jumps to the spot on the screen where the hero is.  Strange and very
noticeable if that spot is covered by the menu, although I didn't
notice it when working on digits as group accelerators (changes for
that didn't trigger this).

Despite the cursor_on_u location, it isn't related to the recent
flush_screen/cursor_on_u changes either.  In 3.6.x, curses used it's
own count entry code.  Early on with to-be-3.7 it was changed to use
the core's get_count(), so uses a different routine to get next input
character.  And the curses edition of that routine deliberately
positions the cursor at the hero's location on the assumption that
it only gets called when the map window is active.

doc/fixes3-7-0.txt
win/curses/cursmain.c

index cf5b1dcc89d796f93372468624d20c750ca0dc14..6557ee100aefae1bed6d342cadc0e3e10c8aea8a 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.784 $ $NHDT-Date: 1644602632 2022/02/11 18:03:52 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.788 $ $NHDT-Date: 1644610217 2022/02/11 20:10:17 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -1028,6 +1028,9 @@ curses: messages were tagged by turn in 3.6.x so that ^P can place a separator
        between groups of messages; somehow the line of code that recorded
        the turn vanished so ^P behaved as if every message came on its own
        distinct turn, resulting in lots of "---" separators
+curses: when entering a count while in a menu, cursor would jump to the spot
+       on screen where the hero was, even if menu covered that part of map;
+       post-3.6--started when curses was changed to use core's get_count()
 Qt: at Xp levels above 20 with 'showexp' On, the combined status field
        "Level:NN/nnnnnnnn" was too big and truncated by a char at each end
 Qt: searching a text window for something that wasn't found and then searching
index d9cfcbfc8b90983a87684da06e8afe6cba389c50..ff4a64c0eebc759b248345c14a8f49779b78b892 100644 (file)
@@ -834,9 +834,15 @@ curses_nhgetch(void)
 {
     int ch;
 
-    curses_prehousekeeping();
+    /* curses_prehousekeeping() assumes that the map window is active;
+       avoid it when a menu is active */
+    if (!activemenu)
+        curses_prehousekeeping();
+
     ch = curses_read_char();
-    curses_posthousekeeping();
+
+    if (!activemenu)
+        curses_posthousekeeping();
 
     return ch;
 }