Fix curses cursor keys

My change to allow fuzzer run in curses caused the cursor keys
to not work (eg. paging through menus with left and right cursor),
so fix that.
This commit is contained in:
Pasi Kallinen
2022-09-24 10:40:34 +03:00
parent c3b007186c
commit ef093d0b30
4 changed files with 16 additions and 5 deletions

View File

@@ -151,6 +151,7 @@ extern boolean curses_map_borders(int *sx, int *sy, int *ex, int *ey,
/* cursmisc.c */
extern int curses_getch(void);
extern int curses_read_char(void);
extern void curses_toggle_color_attr(WINDOW *win, int color, int attr,
int onoff);

View File

@@ -1487,7 +1487,7 @@ menu_get_selections(WINDOW *win, nhmenu *menu, int how)
menu_display_page(menu, win, curpage, selectors, groupaccels);
while (!dismiss) {
curletter = curses_read_char();
curletter = curses_getch();
if (curletter == ERR) {
num_selected = -1;

View File

@@ -26,6 +26,18 @@ static int curs_y = -1;
static int parse_escape_sequence(void);
int
curses_getch(void)
{
int ch;
if (iflags.debug_fuzzer)
ch = randomkey();
else
ch = getch();
return ch;
}
/* Read a character of input from the user */
int
@@ -39,10 +51,7 @@ curses_read_char(void)
/* cancel message suppression; all messages have had a chance to be read */
curses_got_input();
if (iflags.debug_fuzzer)
ch = randomkey();
else
ch = getch();
ch = curses_getch();
#if defined(ALT_0) || defined(ALT_9) || defined(ALT_A) || defined(ALT_Z)
tmpch = ch;
#endif

View File

@@ -8,6 +8,7 @@
/* Global declarations */
int curses_getch(void);
int curses_read_char(void);
void curses_toggle_color_attr(WINDOW *win, int color, int attr, int onoff);
void curses_menu_color_attr(WINDOW *win, int color, int attr, int onoff);