linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
0004-add-halfpage-up-down-vi-bindings.patch
(1946B)
1 From 98c8f49bccd938d67230e97904b5b4f5577964d6 Mon Sep 17 00:00:00 2001
2 From: Jul <jul@qh.is>
3 Date: Tue, 5 Aug 2025 03:20:20 -0400
4 Subject: [PATCH] add halfpage up/down vi bindings
5
6 ---
7 src/tty_interface.c | 17 ++++++++++++-----
8 1 file changed, 12 insertions(+), 5 deletions(-)
9
10 diff --git a/src/tty_interface.c b/src/tty_interface.c
11 index aed8a21..b4a99c1 100644
12 --- a/src/tty_interface.c
13 +++ b/src/tty_interface.c
14 @@ -186,9 +186,16 @@ static void action_del_word(tty_interface_t *state) {
15 state->cursor = cursor;
16 }
17
18 -static void action_del_all(tty_interface_t *state) {
19 - memmove(state->search, &state->search[state->cursor], strlen(state->search) - state->cursor + 1);
20 - state->cursor = 0;
21 +static void action_halfpageup(tty_interface_t *state) {
22 + update_state(state);
23 + for (size_t i = 0; i < (state->options->num_lines / 2) && state->choices->selection > 0; i++)
24 + choices_prev(state->choices);
25 +}
26 +
27 +static void action_halfpagedown(tty_interface_t *state) {
28 + update_state(state);
29 + for (size_t i = 0; i < (state->options->num_lines / 2) && state->choices->selection < state->choices->available - 1; i++)
30 + choices_next(state->choices);
31 }
32
33 static void action_prev(tty_interface_t *state) {
34 @@ -300,10 +307,10 @@ static const keybinding_t keybindings[] = {{"\x1b", action_exit}, /* ESC *
35
36 {KEY_CTRL('H'), action_del_char}, /* Backspace (C-H) */
37 {KEY_CTRL('W'), action_del_word}, /* C-W */
38 - {KEY_CTRL('U'), action_del_all}, /* C-U */
39 {KEY_CTRL('I'), action_autocomplete}, /* TAB (C-I ) */
40 + {KEY_CTRL('U'), action_halfpageup}, /* C-U */
41 + {KEY_CTRL('D'), action_halfpagedown}, /* C-D */
42 {KEY_CTRL('C'), action_exit}, /* C-C */
43 - {KEY_CTRL('D'), action_exit}, /* C-D */
44 {KEY_CTRL('G'), action_exit}, /* C-G */
45 {KEY_CTRL('M'), action_emit}, /* CR */
46 {KEY_CTRL('P'), action_prev}, /* C-P */
47 --
48 2.51.0
49