curses menu count entry

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.
This commit is contained in:
PatR
2022-02-11 12:10:20 -08:00
parent 2ca8ac9a80
commit 14b70dd824
2 changed files with 12 additions and 3 deletions

View 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

View 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;
}