tty: menu search (':') fix

'm O' is a prime candidate for using ':' to select a menu item since
you can use that to avoid scrolling through many pages, but typing ':'
would immediately overwrite two or three lines of the menu with a
status refresh.  curses doesn't suffer from this problem.  X11 and Qt
show menus in separate windows do don't either.  Not sure about WinGUI.

I think that this may have been reported in the past, but if so I don't
recall by whom, or why it wasn't addressed.
This commit is contained in:
PatR
2023-11-16 23:11:54 -08:00
parent a82a897da3
commit 73fed3d5d8
2 changed files with 21 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1294 $ $NHDT-Date: 1699813307 2023/11/12 18:21:47 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1297 $ $NHDT-Date: 1700204638 2023/11/17 07:03:58 $
General Fixes and Modified Features
-----------------------------------
@@ -2024,6 +2024,8 @@ tty: if a menu used full screen and brought up another menu that wasn't full
it with most of the map left blank until after the menu was dismissed
tty: have <return> dismiss pick-none menus instead of acting like '>' (not
only wouldn't dismiss when not on last page, wouldn't dismiss at all)
tty: menu search via ':' would clobber part of the menu with a status line
refresh if the menu was tall enough to cover that
Unix: when user name is used as default character name, keep hyphenated value
intact instead stripping off dash and whatever follows as if that
specified role/race/&c (worked once upon a time; broken since 3.3.0)

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 getline.c $NHDT-Date: 1596498343 2020/08/03 23:45:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.44 $ */
/* NetHack 3.7 getline.c $NHDT-Date: 1700204638 2023/11/17 07:03:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.56 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -28,8 +28,9 @@ extern char erase_char, kill_char; /* from appropriate tty.c file */
/*
* Read a line closed with '\n' into the array char bufp[BUFSZ].
* (The '\n' is not stored. The string is closed with a '\0'.)
* Reading can be interrupted by an escape ('\033') - now the
* resulting string is "\033".
* Reading can be interrupted by an escape ('\033'). If there is already
* some text, it is removed and prompting continues as if from the start.
* However, if there is no text yet (or anymore) then "\033" is returned.
*/
void
tty_getlin(const char *query, register char *bufp)
@@ -55,8 +56,20 @@ hooked_tty_getlin(
ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT;
ttyDisplay->inread++;
/* issue the prompt */
/*
* Issue the prompt.
*
* custompline() will call vpline() which calls flush_screen() which
* calls bot(). We don't want bot() modifying the screen during
* whatever this prompt is for. If the status area hasn't been
* overwritten, no update is needed, but if has been overwritten (by
* a menu or text window) we don't want status refresh to clobber that
* when the window hasn't finished yet. [Fix for menu search via ':'.]
*/
if (ttyDisplay->lastwin != WIN_STATUS)
gc.context.botl = gc.context.botlx = iflags.time_botl = FALSE;
custompline(OVERRIDE_MSGTYPE | SUPPRESS_HISTORY, "%s ", query);
#ifdef EDIT_GETLIN
/* bufp is input/output; treat current contents (presumed to be from
previous getlin()) as default input */
@@ -90,7 +103,7 @@ hooked_tty_getlin(
ttyDisplay->intr--;
*bufp = 0;
}
if (c == '\020') { /* ctrl-P */
if (c == '\020') { /* ctrl-P, doesn't honor rebinding #prevmsg cmd */
if (iflags.prevmsg_window != 's') {
int sav = ttyDisplay->inread;