From a445e55a551665fc933c055990f5cffb6a5ae236 Mon Sep 17 00:00:00 2001 From: Jeffrey Middleton Date: Thu, 5 Mar 2009 16:43:04 -0600 Subject: [PATCH] list_window: Added scroll up/down half-screen commands Added commands to scroll up/down half a screen, using the generic functions from the last commit. Mapped by default to B and N, to go along nicely with Ctrl-B and Ctrl-N for single-line scrolling. --- src/command.c | 4 ++++ src/command.h | 2 ++ src/list_window.c | 6 ++++++ src/screen_help.c | 2 ++ 4 files changed, 14 insertions(+) diff --git a/src/command.c b/src/command.c index 7182d16..809f449 100644 --- a/src/command.c +++ b/src/command.c @@ -96,6 +96,10 @@ static command_definition_t cmds[] = { N_("Scroll up one line") }, { { 2, 0, 0 }, 0, CMD_LIST_SCROLL_UP_LINE, "scroll-up-line", N_("Scroll down one line") }, + { { 'N', 0, 0 }, 0, CMD_LIST_SCROLL_DOWN_HALF, "scroll-down-half", + N_("Scroll up half a screen") }, + { { 'B', 0, 0 }, 0, CMD_LIST_SCROLL_UP_HALF, "scroll-up-half", + N_("Scroll down half a screen") }, /* basic screens */ diff --git a/src/command.h b/src/command.h index abfca44..3adc3d2 100644 --- a/src/command.h +++ b/src/command.h @@ -76,6 +76,8 @@ typedef enum { CMD_LIST_VISUAL_SELECT, CMD_LIST_SCROLL_UP_LINE, CMD_LIST_SCROLL_DOWN_LINE, + CMD_LIST_SCROLL_UP_HALF, + CMD_LIST_SCROLL_DOWN_HALF, CMD_MOUSE_EVENT, CMD_SCREEN_UPDATE, CMD_SCREEN_PREVIOUS, diff --git a/src/list_window.c b/src/list_window.c index a127a5b..347cfb2 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -490,6 +490,12 @@ list_window_cmd(struct list_window *lw, unsigned rows, command_t cmd) case CMD_LIST_SCROLL_DOWN_LINE: list_window_scroll_down(lw, rows, 1); break; + case CMD_LIST_SCROLL_UP_HALF: + list_window_scroll_up(lw, (lw->rows - 1) / 2); + break; + case CMD_LIST_SCROLL_DOWN_HALF: + list_window_scroll_down(lw, rows, (lw->rows - 1) / 2); + break; default: return false; } diff --git a/src/screen_help.c b/src/screen_help.c index e731664..53b3499 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -49,6 +49,8 @@ static help_text_row_t help_text[] = { { 0, CMD_LIST_VISUAL_SELECT, NULL }, { 0, CMD_LIST_SCROLL_UP_LINE, NULL}, { 0, CMD_LIST_SCROLL_DOWN_LINE, NULL}, + { 0, CMD_LIST_SCROLL_UP_HALF, NULL}, + { 0, CMD_LIST_SCROLL_DOWN_HALF, NULL}, { 0, CMD_NONE, NULL }, { 0, CMD_SCREEN_PREVIOUS,NULL }, { 0, CMD_SCREEN_NEXT, NULL }, -- 2.30.2