From 3fcd56e6e3d6336d7584626ee936156e1eb69546 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 23 Mar 2023 12:47:56 -0700 Subject: [PATCH] curses: resize vs beep Dynamically resizing the terminal window during play by dragging its edges was beeping (a lot if you dragged slowly). Recogize the key code sent for that instead of complaining about unrecognized input. --- win/curses/cursmisc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 9c9c8cd42..89cbbc765 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -63,13 +63,6 @@ curses_read_char(void) ch = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */ } -#ifdef KEY_RESIZE - /* Handle resize events via get_nh_event, not this code */ - if (ch == KEY_RESIZE) { - ch = C('r'); /* NetHack doesn't know what to do with KEY_RESIZE */ - } -#endif - if (counting && !isdigit(ch)) { /* dismiss count window if necessary */ curses_count_window(NULL); curses_refresh_nethack_windows(); @@ -964,6 +957,13 @@ curses_convert_keys(int key) ret = iflags.num_pad ? '5' : 'g'; break; #endif /* KEY_B2 */ +#ifdef KEY_RESIZE + case KEY_RESIZE: + /* actual resize is handled elsewhere; just avoid beep/bell here */ + ret = '\033'; /* was C('R'); -- nethack's redraw command */ + reject = FALSE; + break; +#endif } /* phone layout is inverted, 123 on top and 789 on bottom; if player has