Add config option for faux scrollback

Some people have complained about the behavior of faux scrollback inside
of vim/tmux, however from what I can tell, alacritty behaves the same
way as other terminal emulators that support faux scrollback.

However there are a lot of terminal emulators that do not support faux
scrollback at all, which leads to people complaining about unusual
scroll behavior.

This is my proposal on how to solve this issue, by giving people that do
not like the VTE-Style faux scrolling the option to opt-out.
This commit is contained in:
Christian Dürr 2017-12-25 20:40:08 +01:00 committed by Joe Wilm
parent 8ce553f28a
commit aa1f31785e
2 changed files with 12 additions and 3 deletions

View File

@ -65,6 +65,10 @@ fn deserialize_duration_ms<'a, D>(deserializer: D) -> ::std::result::Result<Dura
pub struct Mouse {
pub double_click: ClickHandler,
pub triple_click: ClickHandler,
/// Send up/down arrow when scrolling in alt screen buffer
#[serde(default="true_bool")]
pub faux_scrollback: bool,
}
impl Default for Mouse {
@ -75,7 +79,8 @@ impl Default for Mouse {
},
triple_click: ClickHandler {
threshold: Duration::from_millis(300),
}
},
faux_scrollback: true,
}
}
}

View File

@ -391,7 +391,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
};
for _ in 0..(to_scroll.abs() as usize) {
if self.ctx.terminal_mode().intersects(mode::TermMode::ALT_SCREEN) {
if self.mouse_config.faux_scrollback &&
self.ctx.terminal_mode().intersects(mode::TermMode::ALT_SCREEN)
{
// Faux scrolling
if code == 64 {
// Scroll up one line
@ -426,7 +428,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
65
};
if self.ctx.terminal_mode().intersects(mode::TermMode::ALT_SCREEN) {
if self.mouse_config.faux_scrollback &&
self.ctx.terminal_mode().intersects(mode::TermMode::ALT_SCREEN)
{
// Faux scrolling
if button == 64 {
// Scroll up one line