mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-07 04:06:07 -05:00
commit
2d4a59ab99
6 changed files with 112 additions and 11 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
|
@ -18,7 +18,11 @@
|
|||
|
||||
* `$XDG_CONFIG_HOME/footrc`/`~/.config/footrc`. Use
|
||||
`$XDG_CONFIG_HOME/foot/foot.ini`/`~/.config/foot/foot.ini` instead.
|
||||
* **scrollback** option in `foot.ini`. Use **scrollback.lines** instead.
|
||||
* **scrollback** option in `foot.ini`. Use **scrollback.lines**
|
||||
instead.
|
||||
* **scrollback-up** key binding. Use **scrollback-up-page** instead.
|
||||
* **scrollback-down** key binding. Use **scrollback-down-page**
|
||||
instead.
|
||||
|
||||
|
||||
### Added
|
||||
|
|
@ -64,6 +68,11 @@
|
|||
`-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-page** and **scrollback-down-half-page** key
|
||||
bindings. They scroll up/down half of a page in the scrollback
|
||||
(https://codeberg.org/dnkl/foot/issues/128).
|
||||
* **scrollback-up-line** and **scrollback-down-line** key
|
||||
bindings. They scroll up/down a single line in the scrollback.
|
||||
|
||||
|
||||
### Removed
|
||||
|
|
@ -81,6 +90,7 @@
|
|||
`$XDG_CONFIG_HOME/foot/foot.ini` or in `$XDG_CONFIG_HOME/footrc`.
|
||||
* Minimum window size changed from four rows and 20 columns, to 1 row
|
||||
and 2 columns.
|
||||
* **scrollback-up/down** renamed to **scrollback-up/down-page**.
|
||||
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
54
config.c
54
config.c
|
|
@ -56,7 +56,13 @@ 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_PAGE] = "scrollback-up-page",
|
||||
[BIND_ACTION_SCROLLBACK_UP_HALF_PAGE] = "scrollback-up-half-page",
|
||||
[BIND_ACTION_SCROLLBACK_UP_LINE] = "scrollback-up-line",
|
||||
[BIND_ACTION_SCROLLBACK_DOWN] = "scrollback-down",
|
||||
[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_CLIPBOARD_COPY] = "clipboard-copy",
|
||||
[BIND_ACTION_CLIPBOARD_PASTE] = "clipboard-paste",
|
||||
[BIND_ACTION_PRIMARY_PASTE] = "primary-paste",
|
||||
|
|
@ -456,7 +462,7 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
|||
strcmp(key, "geometry") == 0 /* deprecated */)
|
||||
{
|
||||
if (strcmp(key, "geometry") == 0) {
|
||||
LOG_WARN("deprecated: [default]: geometry: use 'initial-window-size-pixels' instead'");
|
||||
LOG_WARN("deprecated: %s:%d: [default]: geometry: use 'initial-window-size-pixels' instead'", path, lineno);
|
||||
|
||||
const char *fmt = "%s:%d: \033[1mgeometry\033[21m, use \033[1minitial-window-size-pixels\033[21m instead";
|
||||
char *text = xasprintf(fmt, path, lineno);
|
||||
|
|
@ -551,7 +557,7 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
|||
}
|
||||
|
||||
else if (strcmp(key, "scrollback") == 0) {
|
||||
LOG_WARN("deprecated: [default]: scrollback: use 'scrollback.lines' instead'");
|
||||
LOG_WARN("deprecated: %s:%d: [default]: scrollback: use 'scrollback.lines' instead'", path, lineno);
|
||||
|
||||
const char *fmt = "%s:%d: \033[1mdefault.scrollback\033[21m, use \033[1mscrollback.lines\033[21m instead";
|
||||
char *text = xasprintf(fmt, path, lineno);
|
||||
|
|
@ -1032,6 +1038,44 @@ argv_compare(char *const *argv1, char *const *argv2)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_deprecated_key_binding(struct config *conf,
|
||||
const char *section,
|
||||
enum bind_action_normal action,
|
||||
const char *path, unsigned lineno)
|
||||
{
|
||||
enum bind_action_normal replacement = BIND_ACTION_NONE;
|
||||
|
||||
switch (action) {
|
||||
case BIND_ACTION_SCROLLBACK_UP:
|
||||
replacement = BIND_ACTION_SCROLLBACK_UP_PAGE;
|
||||
break;
|
||||
|
||||
case BIND_ACTION_SCROLLBACK_DOWN:
|
||||
replacement = BIND_ACTION_SCROLLBACK_DOWN_PAGE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_WARN("deprecated: %s:%d: [%s]: key binding %s, use %s instead",
|
||||
path, lineno, section,
|
||||
binding_action_map[action], binding_action_map[replacement]);
|
||||
|
||||
const char *fmt = "%s:%d: [%s]: \033[1m%s\033[21m, use \033[1m%s\033[21m instead";
|
||||
char *text = xasprintf(
|
||||
fmt, path, lineno, section,
|
||||
binding_action_map[action], binding_action_map[replacement]);
|
||||
|
||||
struct user_notification deprecation = {
|
||||
.kind = USER_NOTIFICATION_DEPRECATED,
|
||||
.text = text,
|
||||
};
|
||||
tll_push_back(conf->notifications, deprecation);
|
||||
|
||||
}
|
||||
|
||||
static bool
|
||||
parse_section_key_bindings(
|
||||
const char *key, const char *value, struct config *conf,
|
||||
|
|
@ -1072,6 +1116,9 @@ parse_section_key_bindings(
|
|||
if (strcmp(key, binding_action_map[action]) != 0)
|
||||
continue;
|
||||
|
||||
maybe_deprecated_key_binding(
|
||||
conf, "key-bindings", action, path, lineno);
|
||||
|
||||
/* Unset binding */
|
||||
if (strcasecmp(value, "none") == 0) {
|
||||
tll_foreach(conf->bindings.key, it) {
|
||||
|
|
@ -1344,6 +1391,9 @@ parse_section_mouse_bindings(
|
|||
if (strcmp(key, binding_action_map[action]) != 0)
|
||||
continue;
|
||||
|
||||
maybe_deprecated_key_binding(
|
||||
conf, "mouse-bindings", action, path, lineno);
|
||||
|
||||
/* Unset binding */
|
||||
if (strcasecmp(value, "none") == 0) {
|
||||
tll_foreach(conf->bindings.mouse, it) {
|
||||
|
|
|
|||
|
|
@ -238,11 +238,24 @@ default shortcut for *search-start*, you first need to unmap the
|
|||
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_.
|
||||
*scrollback-up-page*
|
||||
Scrolls up/back one page in history. Default: _Shift+Page\_Up_.
|
||||
|
||||
*scrollback-down*
|
||||
Scroll down/forward in history. Default: _Shift+Page\_Down_.
|
||||
*scrollback-up-half-page*
|
||||
Scrolls up/back half of a page in history. Default: _not set_.
|
||||
|
||||
*scrollback-up-line*
|
||||
Scrolls up/back a single line in history. Default: _not set_.
|
||||
|
||||
*scrollback-down-page*
|
||||
Scroll down/forward one page in history. Default:
|
||||
_Shift+Page\_Down_.
|
||||
|
||||
*scrollback-down-half-page*
|
||||
Scroll down/forward half of a page in history. Default: _not set_.
|
||||
|
||||
*scrollback-down-line*
|
||||
Scroll down/forward a single line in history. Default: _not set_.
|
||||
|
||||
*clipboard-copy*
|
||||
Copies the current selection into the _clipboard_. Default: _Control+Shift+C_.
|
||||
|
|
|
|||
8
foot.ini
8
foot.ini
|
|
@ -57,8 +57,12 @@
|
|||
# button-close-color=ffff0000
|
||||
|
||||
[key-bindings]
|
||||
# scrollback-up=Shift+Page_Up
|
||||
# scrollback-down=Shift+Page_Down
|
||||
# scrollback-up-page=Shift+Page_Up
|
||||
# scrollback-up-half-page=none
|
||||
# scrollback-up-line=none
|
||||
# scrollback-down-page=Shift+Page_Down
|
||||
# scrollback-down-half-page=none
|
||||
# scrollback-down-line=none
|
||||
# clipboard-copy=Control+Shift+C
|
||||
# clipboard-paste=Control+Shift+V
|
||||
# search-start=Control+Shift+R
|
||||
|
|
|
|||
18
input.c
18
input.c
|
|
@ -88,13 +88,31 @@ execute_binding(struct seat *seat, struct terminal *term,
|
|||
return true;
|
||||
|
||||
case BIND_ACTION_SCROLLBACK_UP:
|
||||
case BIND_ACTION_SCROLLBACK_UP_PAGE:
|
||||
cmd_scrollback_up(term, term->rows);
|
||||
return true;
|
||||
|
||||
case BIND_ACTION_SCROLLBACK_UP_HALF_PAGE:
|
||||
cmd_scrollback_up(term, max(term->rows / 2, 1));
|
||||
return true;
|
||||
|
||||
case BIND_ACTION_SCROLLBACK_UP_LINE:
|
||||
cmd_scrollback_up(term, 1);
|
||||
return true;
|
||||
|
||||
case BIND_ACTION_SCROLLBACK_DOWN:
|
||||
case BIND_ACTION_SCROLLBACK_DOWN_PAGE:
|
||||
cmd_scrollback_down(term, term->rows);
|
||||
return true;
|
||||
|
||||
case BIND_ACTION_SCROLLBACK_DOWN_HALF_PAGE:
|
||||
cmd_scrollback_down(term, max(term->rows / 2, 1));
|
||||
return true;
|
||||
|
||||
case BIND_ACTION_SCROLLBACK_DOWN_LINE:
|
||||
cmd_scrollback_down(term, 1);
|
||||
return true;
|
||||
|
||||
case BIND_ACTION_CLIPBOARD_COPY:
|
||||
selection_to_clipboard(seat, term, serial);
|
||||
return true;
|
||||
|
|
|
|||
10
wayland.h
10
wayland.h
|
|
@ -26,8 +26,14 @@ typedef tll(struct key_binding) key_binding_list_t;
|
|||
|
||||
enum bind_action_normal {
|
||||
BIND_ACTION_NONE,
|
||||
BIND_ACTION_SCROLLBACK_UP,
|
||||
BIND_ACTION_SCROLLBACK_DOWN,
|
||||
BIND_ACTION_SCROLLBACK_UP, /* Deprecated, alias for UP_PAGE */
|
||||
BIND_ACTION_SCROLLBACK_UP_PAGE,
|
||||
BIND_ACTION_SCROLLBACK_UP_HALF_PAGE,
|
||||
BIND_ACTION_SCROLLBACK_UP_LINE,
|
||||
BIND_ACTION_SCROLLBACK_DOWN, /* Deprecated, alias for DOWN_PAGE */
|
||||
BIND_ACTION_SCROLLBACK_DOWN_PAGE,
|
||||
BIND_ACTION_SCROLLBACK_DOWN_HALF_PAGE,
|
||||
BIND_ACTION_SCROLLBACK_DOWN_LINE,
|
||||
BIND_ACTION_CLIPBOARD_COPY,
|
||||
BIND_ACTION_CLIPBOARD_PASTE,
|
||||
BIND_ACTION_PRIMARY_PASTE,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue