From f869ca45467ce7d326deffcff7e270cbcc893d2c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 23 Feb 2022 19:03:54 +0100 Subject: config/input: add scrollback-home|end key bindings (unbound by default) --- CHANGELOG.md | 2 ++ config.c | 2 ++ doc/foot.ini.5.scd | 6 ++++++ input.c | 14 ++++++++++++++ wayland.h | 2 ++ 5 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e85fb439..62e8a367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ * OSC-22 - set xcursor pointer. * Add "xterm" as fallback cursor where "text" is not available. +* `[key-bindings].scrollback-home|end` options. + ### Changed diff --git a/config.c b/config.c index f50ee685..b247f3e9 100644 --- a/config.c +++ b/config.c @@ -95,6 +95,8 @@ static const char *const binding_action_map[] = { [BIND_ACTION_SCROLLBACK_DOWN_PAGE] = "scrollback-down-page", [BIND_ACTION_SCROLLBACK_DOWN_HALF_PAGE] = "scrollback-down-half-page", [BIND_ACTION_SCROLLBACK_DOWN_LINE] = "scrollback-down-line", + [BIND_ACTION_SCROLLBACK_HOME] = "scrollback-home", + [BIND_ACTION_SCROLLBACK_END] = "scrollback-end", [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 7763a8b3..9127c015 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -681,6 +681,12 @@ e.g. *search-start=none*. *scrollback-down-line* Scroll down/forward a single line in history. Default: _not bound_. +*scrollback-home* + Scroll to the beginning of the scrollback. Default: _not bound_. + +*scrollback-end* + Scroll to the end (bottom) of the scrollback. Default: _not bound_. + *clipboard-copy* Copies the current selection into the _clipboard_. Default: _Control+Shift+c_ _XF86Copy_. diff --git a/input.c b/input.c index 26af0807..f402fa3d 100644 --- a/input.c +++ b/input.c @@ -134,6 +134,20 @@ execute_binding(struct seat *seat, struct terminal *term, } break; + case BIND_ACTION_SCROLLBACK_HOME: + if (term->grid == &term->normal) { + cmd_scrollback_up(term, term->grid->num_rows); + return true; + } + break; + + case BIND_ACTION_SCROLLBACK_END: + if (term->grid == &term->normal) { + cmd_scrollback_down(term, term->grid->num_rows); + return true; + } + break; + case BIND_ACTION_CLIPBOARD_COPY: selection_to_clipboard(seat, term, serial); return true; diff --git a/wayland.h b/wayland.h index 2d753e70..e593073e 100644 --- a/wayland.h +++ b/wayland.h @@ -38,6 +38,8 @@ enum bind_action_normal { BIND_ACTION_SCROLLBACK_DOWN_PAGE, BIND_ACTION_SCROLLBACK_DOWN_HALF_PAGE, BIND_ACTION_SCROLLBACK_DOWN_LINE, + BIND_ACTION_SCROLLBACK_HOME, + BIND_ACTION_SCROLLBACK_END, BIND_ACTION_CLIPBOARD_COPY, BIND_ACTION_CLIPBOARD_PASTE, BIND_ACTION_PRIMARY_PASTE, -- cgit v1.3