summaryrefslogtreecommitdiff
path: root/src/tty_interface.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2016-06-20 01:57:07 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2016-06-22 18:32:15 -0700
commit35cc756ae0a1e2c1f3d095711903012a520a561e (patch)
tree488c0692e84fe9b2a262162395f6f38c135f8b7c /src/tty_interface.c
parentc73dad5d14740b48a2ba9e6d46472da22f6c1337 (diff)
Add pageup and pagedown
Diffstat (limited to 'src/tty_interface.c')
-rw-r--r--src/tty_interface.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tty_interface.c b/src/tty_interface.c
index 28ce586..9044723 100644
--- a/src/tty_interface.c
+++ b/src/tty_interface.c
@@ -131,6 +131,16 @@ static void action_next(tty_interface_t *state) {
choices_next(state->choices);
}
+static void action_pageup(tty_interface_t *state) {
+ for(size_t i = 0; i < state->options->num_lines && state->choices->selection > 0; i++)
+ choices_prev(state->choices);
+}
+
+static void action_pagedown(tty_interface_t *state) {
+ for(size_t i = 0; i < state->options->num_lines && state->choices->selection < state->choices->available-1; i++)
+ choices_next(state->choices);
+}
+
static void action_autocomplete(tty_interface_t *state) {
strncpy(state->search, choices_get(state->choices, state->choices->selection), SEARCH_SIZE_MAX);
}
@@ -200,6 +210,8 @@ static const keybinding_t keybindings[] = {{"\x7f", action_del_char}, /* DEL */
{"\x1bOA", action_prev}, /* UP */
{"\x1b[B", action_next}, /* DOWN */
{"\x1bOB", action_next}, /* DOWN */
+ {"\x1b[5~", action_pageup},
+ {"\x1b[6~", action_pagedown},
{NULL, NULL}};
#undef KEY_CTRL