fix github issue #1002 - curses screen flash

Reported by jeremyhetzler:  with recently revised curses interface,
when dismissing a menu or prompt with ESC the screen flashed.

This was caused by calling beep() when the terminal is set for
'visible bell' (of flagged as incapable of 'audible bell'); the
curses library flashed the screen deliberately.  We don't want that.

Change the function key handling to not call beep() when an ESC
is typed by itself rather than being the leading part of a
multi-character escape sequence.  beep() will still be called if
you type an arrow key (or other function key) when nethack is
expecting text input.  That's what the recent change intended.

This also removes an early return from parse_escape_sequence()
when a number pad key generates an escape sequence.  I don't have
a number pad to verify that this bit works as intended.

Closes #1002
This commit is contained in:
PatR
2023-03-23 11:12:34 -07:00
parent 8f142020a1
commit f5d400be75
2 changed files with 25 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1093 $ $NHDT-Date: 1672605786 2023/01/01 20:43:06 $
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1139 $ $NHDT-Date: 1679595146 2023/03/23 18:12:26 $
General Fixes and Modified Features
-----------------------------------
@@ -1535,6 +1535,10 @@ curses: for screen refresh, don't attempt to refresh windows that haven't been
set up yet or have already been shut down
curses: for raw_print() in #if PDCURSES config, don't attempt to write to
message window if it isn't set up yet or has already been shut down
curses: typing ESC to cancel something issued a beep; if the terminal was set
to 'visible bell', the screen flashed; only beep when the ESC is part
of an escape sequence--other than M-c generating ESC c--and nethack
is expecting text rather than a command or direction
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