mirror of
https://github.com/wez/wezterm.git
synced 2024-12-22 12:51:31 +03:00
wezterm: add alternate_buffer_wheel_scroll_speed option and increase to 3
More details in the included docs. closes: #432
This commit is contained in:
parent
a8d4743e03
commit
d10f7bbb1b
@ -861,6 +861,13 @@ pub struct Config {
|
||||
|
||||
#[serde(default = "default_paste_source")]
|
||||
pub default_clipboard_paste_source: ClipboardPasteSource,
|
||||
|
||||
#[serde(default = "default_alternate_buffer_wheel_scroll_speed")]
|
||||
pub alternate_buffer_wheel_scroll_speed: u8,
|
||||
}
|
||||
|
||||
fn default_alternate_buffer_wheel_scroll_speed() -> u8 {
|
||||
3
|
||||
}
|
||||
|
||||
fn default_word_boundary() -> String {
|
||||
|
@ -30,4 +30,8 @@ impl wezterm_term::TerminalConfiguration for TermConfig {
|
||||
|
||||
config.resolved_palette.clone().into()
|
||||
}
|
||||
|
||||
fn alternate_buffer_wheel_scroll_speed(&self) -> u8 {
|
||||
configuration().alternate_buffer_wheel_scroll_speed
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ brief notes about them may accumulate here.
|
||||
* New: Added a new default `CTRL-Insert` key assignment bound to `Copy`
|
||||
* macOS: Windows now have drop-shadows when they are opaque. These were disabled due transparency support was added. Thanks to [Rice](https://github.com/fanzeyi)! [#445](https://github.com/wez/wezterm/pull/445)
|
||||
* Unix: adjust font-config patterns to also match "dual spacing" fonts such as [Iosevka Term](https://typeof.net/Iosevka/). Thanks to [Leiser](https://github.com/leiserfg)! [#446](https://github.com/wez/wezterm/pull/446)
|
||||
* New: Added [alternate_buffer_wheel_scroll_speed](config/lua/config/alternate_buffer_wheel_scroll_speed.md) option to control how many cursor key presses are generated by the mouse wheel when the alternate screen is active. The new default for this is a faster-than-previous-releases 3 lines per wheel tick. [#432](https://github.com/wez/wezterm/issues/432)
|
||||
|
||||
### 20201101-103216-403d002d
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
# `alternate_buffer_wheel_scroll_speed = 3`
|
||||
|
||||
*Since: nightly builds*
|
||||
|
||||
Normally the vertical mouse wheel will scroll the terminal viewport
|
||||
so that different sections of the scrollback are visible.
|
||||
|
||||
When an application activates the *Alternate Screen Buffer* (this is
|
||||
common for "full screen" terminal programs such as pagers and editors),
|
||||
the alternate screen doesn't have a scrollback.
|
||||
|
||||
In this mode, if the application hasn't enabled mouse reporting, wezterm will
|
||||
generate Arrow Up/Down key events when the vertical mouse wheel is scrolled.
|
||||
|
||||
The `alternate_buffer_wheel_scroll_speed` specifies how many arrow key presses
|
||||
are generated by a single scroll wheel "tick".
|
||||
|
||||
The default for this value is `3`, which means that a single wheel up tick will
|
||||
appear to the application as though the user pressed arrow up three times in
|
||||
quick succession.
|
||||
|
||||
In versions of wezterm prior to this configuration option being available, the
|
||||
behavior was the same except that the effective value of this option was always
|
||||
`1`.
|
||||
|
@ -68,4 +68,8 @@ pub trait TerminalConfiguration: std::fmt::Debug {
|
||||
fn resize_preserves_scrollback(&self) -> bool {
|
||||
cfg!(windows)
|
||||
}
|
||||
|
||||
fn alternate_buffer_wheel_scroll_speed(&self) -> u8 {
|
||||
3
|
||||
}
|
||||
}
|
||||
|
@ -531,14 +531,16 @@ impl TerminalState {
|
||||
self.writer.flush()?;
|
||||
} else if self.screen.is_alt_screen_active() {
|
||||
// Send cursor keys instead (equivalent to xterm's alternateScroll mode)
|
||||
self.key_down(
|
||||
match event.button {
|
||||
MouseButton::WheelDown(_) => KeyCode::DownArrow,
|
||||
MouseButton::WheelUp(_) => KeyCode::UpArrow,
|
||||
_ => bail!("unexpected mouse event"),
|
||||
},
|
||||
KeyModifiers::default(),
|
||||
)?;
|
||||
for _ in 0..self.config.alternate_buffer_wheel_scroll_speed() {
|
||||
self.key_down(
|
||||
match event.button {
|
||||
MouseButton::WheelDown(_) => KeyCode::DownArrow,
|
||||
MouseButton::WheelUp(_) => KeyCode::UpArrow,
|
||||
_ => bail!("unexpected mouse event"),
|
||||
},
|
||||
KeyModifiers::default(),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user