patch-src_tty_interface.c - pkgsrc-localpatches - leot's pkgsrc LOCALPATCHES
(HTM) hg clone https://bitbucket.org/iamleot/pkgsrc-localpatches
(DIR) Log
(DIR) Files
(DIR) Refs
---
patch-src_tty_interface.c
---
1 $NetBSD$
2
3 Add support to go to the top and bottom like dmenu.
4
5 --- src/tty_interface.c.orig 2018-09-23 22:05:55.000000000 +0000
6 +++ src/tty_interface.c
7 @@ -224,6 +224,18 @@ static void action_pagedown(tty_interfac
8 choices_next(state->choices);
9 }
10
11 +static void action_top(tty_interface_t *state) {
12 + update_state(state);
13 + while(state->choices->selection > 0)
14 + choices_prev(state->choices);
15 +}
16 +
17 +static void action_bottom(tty_interface_t *state) {
18 + update_state(state);
19 + while(state->choices->selection < state->choices->available-1)
20 + choices_next(state->choices);
21 +}
22 +
23 static void action_autocomplete(tty_interface_t *state) {
24 update_state(state);
25 const char *current_selection = choices_get(state->choices, state->choices->selection);
26 @@ -292,8 +304,8 @@ static const keybinding_t keybindings[]
27 {KEY_CTRL('N'), action_next}, /* C-N */
28 {KEY_CTRL('K'), action_prev}, /* C-K */
29 {KEY_CTRL('J'), action_next}, /* C-J */
30 - {KEY_CTRL('A'), action_beginning}, /* C-A */
31 - {KEY_CTRL('E'), action_end}, /* C-E */
32 + {KEY_CTRL('A'), action_top}, /* C-A */
33 + {KEY_CTRL('E'), action_bottom}, /* C-E */
34
35 {"\x1bOD", action_left}, /* LEFT */
36 {"\x1b[D", action_left}, /* LEFT */