Code

list_window: Added scroll up/down half-screen commands
authorJeffrey Middleton <jefromi@gmail.com>
Thu, 5 Mar 2009 22:43:04 +0000 (16:43 -0600)
committerJeffrey Middleton <jefromi@gmail.com>
Thu, 5 Mar 2009 19:15:39 +0000 (13:15 -0600)
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
src/command.h
src/list_window.c
src/screen_help.c

index 7182d168689a9eef59c998676bc1eadee4e69ee1..809f449f07be4c0da30e60e5fb3de6626391c8a3 100644 (file)
@@ -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 */
index abfca4401ab99183bc741db7cf313be75e2985cd..3adc3d2f758e0925511ca1bdbe8f75ea1e5fe2af 100644 (file)
@@ -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,
index a127a5b07b93bdde85302d638670b488e42c6269..347cfb2d3fdba6b70cb24123e07900541e24648e 100644 (file)
@@ -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;
        }
index e731664f66898f2ae5ecf644b6c4ff7546bddf6a..53b349989c6a15870203b58d35abb92c68d9a5bd 100644 (file)
@@ -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 },