mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
config: add mouse.alternate-scroll-mode option
This option controls the initial state of the Alternate Scroll Mode, and defaults to ‘enabled’.
This commit is contained in:
parent
04c1bab7b0
commit
f2497320c6
6 changed files with 31 additions and 0 deletions
|
|
@ -73,6 +73,12 @@
|
|||
(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.
|
||||
* **mouse.alternate-scroll-mode** option to `foot.ini`. This option
|
||||
controls the initial state of the _Alternate Scroll Mode_, and
|
||||
defaults to `yes`. When enabled, mouse events are translated to
|
||||
up/down key events in the alternate screen, letting you scroll in
|
||||
e.g. `less` and other applications without enabling native mouse
|
||||
support in them (https://codeberg.org/dnkl/foot/issues/135).
|
||||
|
||||
|
||||
### Removed
|
||||
|
|
|
|||
4
config.c
4
config.c
|
|
@ -764,6 +764,9 @@ parse_section_mouse(const char *key, const char *value, struct config *conf,
|
|||
if (strcmp(key, "hide-when-typing") == 0)
|
||||
conf->mouse.hide_when_typing = str_to_bool(value);
|
||||
|
||||
else if (strcmp(key, "alternate-scroll-mode") == 0)
|
||||
conf->mouse.alternate_scroll_mode = str_to_bool(value);
|
||||
|
||||
else {
|
||||
LOG_AND_NOTIFY_ERR("%s:%d: [mouse]: %s: invalid key", path, lineno, key);
|
||||
return false;
|
||||
|
|
@ -1907,6 +1910,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
},
|
||||
.mouse = {
|
||||
.hide_when_typing = false,
|
||||
.alternate_scroll_mode = true,
|
||||
},
|
||||
.csd = {
|
||||
.preferred = CONF_CSD_PREFER_SERVER,
|
||||
|
|
|
|||
1
config.h
1
config.h
|
|
@ -119,6 +119,7 @@ struct config {
|
|||
|
||||
struct {
|
||||
bool hide_when_typing;
|
||||
bool alternate_scroll_mode;
|
||||
} mouse;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -143,6 +143,24 @@ applications can change these at runtime.
|
|||
*hide-when-typing*
|
||||
Boolean. When enabled, the mouse cursor is hidden while typing.
|
||||
|
||||
*alternate-scroll-mode*
|
||||
Boolean. This option controls the initial value for the _alternate
|
||||
scroll mode_. When this mode is enabled, mouse scroll events are
|
||||
translated to _up_/_down_ key events when displaying the alternate
|
||||
screen.
|
||||
|
||||
This lets you scroll with the mouse in e.g. pagers (like _less_)
|
||||
without enabling native mouse support in them.
|
||||
|
||||
Alternate scrolling is *not* used if the application enables
|
||||
native mouse support.
|
||||
|
||||
This option can be modified by applications at run-time using the
|
||||
escape sequences *CSI ? 1007 h* (enable) and *CSI ? 1007 l`
|
||||
(disable).
|
||||
|
||||
Default: _yes_.
|
||||
|
||||
|
||||
# SECTION: colors
|
||||
|
||||
|
|
|
|||
1
foot.ini
1
foot.ini
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
[mouse]
|
||||
# hide-when-typing=no
|
||||
# alternate-scroll-mode=yes
|
||||
|
||||
[colors]
|
||||
# alpha=1.0
|
||||
|
|
|
|||
|
|
@ -964,6 +964,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
|
|||
.grid = &term->normal,
|
||||
.composed_count = 0,
|
||||
.composed = NULL,
|
||||
.alt_scrolling = conf->mouse.alternate_scroll_mode,
|
||||
.meta = {
|
||||
.esc_prefix = true,
|
||||
.eight_bit = true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue