From: PatR Date: Fri, 11 Feb 2022 20:10:20 +0000 (-0800) Subject: curses menu count entry X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14b70dd8249438e1947fca75e87a1b9eebf5599e;p=nethack 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. --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index cf5b1dcc8..6557ee100 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -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 diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index d9cfcbfc8..ff4a64c0e 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -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; }