config: add [key-bindings].noop action

Key combinations assigned to this action will not be sent to the
application.

Closes #765
This commit is contained in:
Daniel Eklöf 2021-10-24 11:49:37 +02:00
parent b2ddacb799
commit bcea929c94
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
6 changed files with 18 additions and 5 deletions

View file

@ -38,8 +38,11 @@
* `notify-focus-inhibit` boolean option, which can be used to control * `notify-focus-inhibit` boolean option, which can be used to control
whether desktop notifications should be inhibited when the terminal whether desktop notifications should be inhibited when the terminal
has keyboard focus has keyboard focus
* `colors.scrollback-indicator` color-pair option, which specifies * `[colors].scrollback-indicator` color-pair option, which specifies
foreground and background colors for the scrollback indicator. foreground and background colors for the scrollback indicator.
* `[key-bindings].noop` action. Key combinations assigned to this
action will not be sent to the application
(https://codeberg.org/dnkl/foot/issues/765).
### Changed ### Changed

View file

@ -84,6 +84,7 @@ static const uint32_t default_color_table[256] = {
static const char *const binding_action_map[] = { static const char *const binding_action_map[] = {
[BIND_ACTION_NONE] = NULL, [BIND_ACTION_NONE] = NULL,
[BIND_ACTION_NOOP] = "noop",
[BIND_ACTION_SCROLLBACK_UP_PAGE] = "scrollback-up-page", [BIND_ACTION_SCROLLBACK_UP_PAGE] = "scrollback-up-page",
[BIND_ACTION_SCROLLBACK_UP_HALF_PAGE] = "scrollback-up-half-page", [BIND_ACTION_SCROLLBACK_UP_HALF_PAGE] = "scrollback-up-half-page",
[BIND_ACTION_SCROLLBACK_UP_LINE] = "scrollback-up-line", [BIND_ACTION_SCROLLBACK_UP_LINE] = "scrollback-up-line",

View file

@ -606,24 +606,28 @@ default shortcut for *search-start*, you first need to unmap the
default binding. This can be done by setting _action=none_; default binding. This can be done by setting _action=none_;
e.g. *search-start=none*. e.g. *search-start=none*.
*noop*
All key combinations listed here will not be sent to the
application. Default: _not bound_.
*scrollback-up-page* *scrollback-up-page*
Scrolls up/back one page in history. Default: _Shift+Page\_Up_. Scrolls up/back one page in history. Default: _Shift+Page\_Up_.
*scrollback-up-half-page* *scrollback-up-half-page*
Scrolls up/back half of a page in history. Default: _not set_. Scrolls up/back half of a page in history. Default: _not bound_.
*scrollback-up-line* *scrollback-up-line*
Scrolls up/back a single line in history. Default: _not set_. Scrolls up/back a single line in history. Default: _not bound_.
*scrollback-down-page* *scrollback-down-page*
Scroll down/forward one page in history. Default: Scroll down/forward one page in history. Default:
_Shift+Page\_Down_. _Shift+Page\_Down_.
*scrollback-down-half-page* *scrollback-down-half-page*
Scroll down/forward half of a page in history. Default: _not set_. Scroll down/forward half of a page in history. Default: _not bound_.
*scrollback-down-line* *scrollback-down-line*
Scroll down/forward a single line in history. Default: _not set_. Scroll down/forward a single line in history. Default: _not bound_.
*clipboard-copy* *clipboard-copy*
Copies the current selection into the _clipboard_. Default: _Control+Shift+c_. Copies the current selection into the _clipboard_. Default: _Control+Shift+c_.

View file

@ -127,6 +127,7 @@
# pipe-selected=[xargs -r firefox] none # pipe-selected=[xargs -r firefox] none
# show-urls-launch=Control+Shift+u # show-urls-launch=Control+Shift+u
# show-urls-copy=none # show-urls-copy=none
# noop=none
[search-bindings] [search-bindings]
# cancel=Control+g Control+c Escape # cancel=Control+g Control+c Escape

View file

@ -87,6 +87,9 @@ execute_binding(struct seat *seat, struct terminal *term,
case BIND_ACTION_NONE: case BIND_ACTION_NONE:
return true; return true;
case BIND_ACTION_NOOP:
return true;
case BIND_ACTION_SCROLLBACK_UP_PAGE: case BIND_ACTION_SCROLLBACK_UP_PAGE:
if (term->grid == &term->normal) { if (term->grid == &term->normal) {
cmd_scrollback_up(term, term->rows); cmd_scrollback_up(term, term->rows);

View file

@ -30,6 +30,7 @@ struct terminal;
enum bind_action_normal { enum bind_action_normal {
BIND_ACTION_NONE, BIND_ACTION_NONE,
BIND_ACTION_NOOP,
BIND_ACTION_SCROLLBACK_UP_PAGE, BIND_ACTION_SCROLLBACK_UP_PAGE,
BIND_ACTION_SCROLLBACK_UP_HALF_PAGE, BIND_ACTION_SCROLLBACK_UP_HALF_PAGE,
BIND_ACTION_SCROLLBACK_UP_LINE, BIND_ACTION_SCROLLBACK_UP_LINE,