From cfb0a075525148767845d7905d758e57679e3b6c Mon Sep 17 00:00:00 2001 From: Tung Nguyen Date: Thu, 17 Mar 2016 14:46:59 +1100 Subject: [PATCH] Stop `>` from closing TTY menus on the last page Pages can now be freely and safely scrolled with the `<` and `>` keys. Space still dismisses menus if it's used on the last page. --- win/tty/wintty.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 9c33a11b1..e99418d7f 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -360,9 +360,6 @@ char **argv UNUSED; (void) signal(SIGWINCH, (SIG_RET_TYPE) winch_handler); #endif - /* add one a space forward menu command alias */ - add_menu_cmd_alias(' ', MENU_NEXT_PAGE); - tty_clear_nhwindow(BASE_WINDOW); tty_putstr(BASE_WINDOW, 0, ""); @@ -1863,6 +1860,7 @@ struct WinDesc *cw; /* set extra chars.. */ Strcat(resp, default_menu_cmds); + Strcat(resp, " "); /* next page or end */ Strcat(resp, "0123456789\033\n\r"); /* counts, quit */ Strcat(resp, gacc); /* group accelerators */ Strcat(resp, mapped_menu_cmds); @@ -1946,12 +1944,15 @@ struct WinDesc *cw; break; } /* else fall through */ + case ' ': case MENU_NEXT_PAGE: if (cw->npages > 0 && curr_page != cw->npages - 1) { curr_page++; page_start = 0; - } else - finished = TRUE; /* questionable behavior */ + } else if (morc == ' ') { + /* ' ' finishes menus here, but stop '>' doing the same. */ + finished = TRUE; + } break; case MENU_PREVIOUS_PAGE: if (cw->npages > 0 && curr_page != 0) { -- 2.40.0