aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md12
-rw-r--r--config.c54
-rw-r--r--doc/foot.ini.5.scd21
-rw-r--r--foot.ini8
-rw-r--r--input.c18
-rw-r--r--wayland.h10
6 files changed, 112 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45787531..0e05fdb3 100644
--- a/CHANGELOG.md
+++ b/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
diff --git a/config.c b/config.c
index 164431c6..dc4d2873 100644
--- a/config.c
+++ b/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) {
diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd
index 25a40e45..b404d716 100644
--- a/doc/foot.ini.5.scd
+++ b/doc/foot.ini.5.scd
@@ -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_.
diff --git a/foot.ini b/foot.ini
index 59806254..7c49be5a 100644
--- a/foot.ini
+++ b/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
diff --git a/input.c b/input.c
index dd9d604e..65dbba0b 100644
--- a/input.c
+++ b/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;
diff --git a/wayland.h b/wayland.h
index e12d816a..430d6b66 100644
--- a/wayland.h
+++ b/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,