diff --git a/CHANGELOG.md b/CHANGELOG.md index 73028676..6701bc2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,9 @@ `-W,--window-size-chars` command line option to `foot`. This option configures the initial window size in **characters**, and is an alternative to **initial-window-size-pixels**. +* **scrollback-up-half** and **scrollback-down-half** key + bindings. They scroll up/down half of a page in the scrollback + (https://codeberg.org/dnkl/foot/issues/128). ### Removed diff --git a/config.c b/config.c index 164431c6..d654eeb9 100644 --- a/config.c +++ b/config.c @@ -56,7 +56,9 @@ static const uint32_t default_bright[] = { static const char *const binding_action_map[] = { [BIND_ACTION_NONE] = NULL, [BIND_ACTION_SCROLLBACK_UP] = "scrollback-up", + [BIND_ACTION_SCROLLBACK_UP_HALF] = "scrollback-up-half", [BIND_ACTION_SCROLLBACK_DOWN] = "scrollback-down", + [BIND_ACTION_SCROLLBACK_DOWN_HALF] = "scrollback-down-half", [BIND_ACTION_CLIPBOARD_COPY] = "clipboard-copy", [BIND_ACTION_CLIPBOARD_PASTE] = "clipboard-paste", [BIND_ACTION_PRIMARY_PASTE] = "primary-paste", diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 25a40e45..b1c0f45f 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -239,10 +239,19 @@ default binding. This can be done by setting _action=none_; e.g. *search-start=none*. *scrollback-up* - Scrolls up/back in history. Default: _Shift+Page\_Up_. + Scrolls up/back one page in history. Default: _Shift+Page\_Up_. + +*scrollback-up-half* + Scrolls up/back half of a page in history. Default: + _Shift+Page\_Up_. *scrollback-down* - Scroll down/forward in history. Default: _Shift+Page\_Down_. + Scroll down/forward one page in history. Default: + _Shift+Page\_Down_. + +*scrollback-down-half* + Scroll down/forward half of a page in history. Default: + _Shift+Page\_Down_. *clipboard-copy* Copies the current selection into the _clipboard_. Default: _Control+Shift+C_. diff --git a/foot.ini b/foot.ini index 59806254..7bb082fd 100644 --- a/foot.ini +++ b/foot.ini @@ -58,7 +58,9 @@ [key-bindings] # scrollback-up=Shift+Page_Up +# scrollback-up-half=none # scrollback-down=Shift+Page_Down +# scrollback-down-half=none # clipboard-copy=Control+Shift+C # clipboard-paste=Control+Shift+V # search-start=Control+Shift+R diff --git a/input.c b/input.c index dd9d604e..f24ec128 100644 --- a/input.c +++ b/input.c @@ -91,10 +91,18 @@ execute_binding(struct seat *seat, struct terminal *term, cmd_scrollback_up(term, term->rows); return true; + case BIND_ACTION_SCROLLBACK_UP_HALF: + cmd_scrollback_up(term, max(term->rows / 2, 1)); + return true; + case BIND_ACTION_SCROLLBACK_DOWN: cmd_scrollback_down(term, term->rows); return true; + case BIND_ACTION_SCROLLBACK_DOWN_HALF: + cmd_scrollback_down(term, max(term->rows / 2, 1)); + return true; + case BIND_ACTION_CLIPBOARD_COPY: selection_to_clipboard(seat, term, serial); return true; diff --git a/wayland.h b/wayland.h index e12d816a..24b8c7b0 100644 --- a/wayland.h +++ b/wayland.h @@ -27,7 +27,9 @@ typedef tll(struct key_binding) key_binding_list_t; enum bind_action_normal { BIND_ACTION_NONE, BIND_ACTION_SCROLLBACK_UP, + BIND_ACTION_SCROLLBACK_UP_HALF, BIND_ACTION_SCROLLBACK_DOWN, + BIND_ACTION_SCROLLBACK_DOWN_HALF, BIND_ACTION_CLIPBOARD_COPY, BIND_ACTION_CLIPBOARD_PASTE, BIND_ACTION_PRIMARY_PASTE,