summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 05803f6)
raw | patch | inline | side by side (parent: 05803f6)
author | Jeffrey Middleton <jefromi@gmail.com> | |
Thu, 5 Mar 2009 22:50:41 +0000 (16:50 -0600) | ||
committer | Jeffrey Middleton <jefromi@gmail.com> | |
Thu, 5 Mar 2009 19:16:57 +0000 (13:16 -0600) |
Added scroll up/down one-line/half-screen to list_window_scroll_cmd,
which is used in text screens.
which is used in text screens.
src/list_window.c | patch | blob | history |
diff --git a/src/list_window.c b/src/list_window.c
index 347cfb2d3fdba6b70cb24123e07900541e24648e..8abad27381316f185b535164824c82455fc0607d 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
list_window_scroll_cmd(struct list_window *lw, unsigned rows, command_t cmd)
{
switch (cmd) {
+ case CMD_LIST_SCROLL_UP_LINE:
case CMD_LIST_PREVIOUS:
if (lw->start > 0)
lw->start--;
break;
+ case CMD_LIST_SCROLL_DOWN_LINE:
case CMD_LIST_NEXT:
if (lw->start + lw->rows < rows)
lw->start++;
lw->start = 0;
break;
+ case CMD_LIST_SCROLL_UP_HALF:
+ if (lw->start > (lw->rows - 1) / 2)
+ lw->start -= (lw->rows - 1) / 2;
+ else
+ lw->start = 0;
+ break;
+
+ case CMD_LIST_SCROLL_DOWN_HALF:
+ lw->start += (lw->rows - 1) / 2;
+ if (lw->start + lw->rows > rows) {
+ if (rows > lw->rows)
+ lw->start = rows - lw->rows;
+ else
+ lw->start = 0;
+ }
+ break;
+
default:
return false;
}