From 052bac0bf1f4a61fbd3dec494de60955f60071e2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 11 Oct 2013 17:42:05 +0300 Subject: [PATCH] Menu item selection on TTYs is now cyclical. src/term.c (read_menu_input): Make selection of menu items cyclical. Suggested by Dmitry Antipov . (tty_menu_activate): Fix off-by-one error when computing max_y. --- src/ChangeLog | 6 ++++++ src/term.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3d92420e7cd..a11737a31c9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-10-11 Eli Zaretskii + + * term.c (read_menu_input): Make selection of menu items + cyclical. Suggested by Dmitry Antipov . + (tty_menu_activate): Fix off-by-one error when computing max_y. + 2013-10-11 Teodor Zlatanov * gnutls.c (gnutls_audit_log_function): Add function for GnuTLS diff --git a/src/term.c b/src/term.c index 27471775d03..71263d41dd2 100644 --- a/src/term.c +++ b/src/term.c @@ -3177,11 +3177,15 @@ read_menu_input (struct frame *sf, int *x, int *y, int min_y, int max_y, { if (*y < max_y) *y += 1; + else + *y = min_y; } else if (EQ (cmd, Qtty_menu_prev_item)) { if (*y > min_y) *y -= 1; + else + *y = max_y; } else if (EQ (cmd, Qtty_menu_select)) st = 1; @@ -3290,7 +3294,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, { int input_status; int min_y = state[0].y; - int max_y = min (min_y + state[0].menu->count, FRAME_LINES (sf)) - 1; + int max_y = min (min_y + state[0].menu->count, FRAME_LINES (sf) - 1) - 1; input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time); if (input_status)