diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-03-09 16:06:39 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2018-03-13 14:52:14 -0700 |
commit | 5dbe6e58b91563d6b011d2be75d13a1e37bd9cac (patch) | |
tree | da00723a792ec19d565371650c293d636a78a565 /src/input.rs | |
parent | fce67e6f3f8495f7ba029c55f2e319626cee56ca (diff) | |
download | alacritty-5dbe6e58b91563d6b011d2be75d13a1e37bd9cac.tar.gz alacritty-5dbe6e58b91563d6b011d2be75d13a1e37bd9cac.zip |
Make normal scrolling line amount configurable
It is now possible to configure the amount of lines the viewport should
scroll when using the normal scrolling mode.
This fixes #1160.
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/input.rs b/src/input.rs index f7514d11..fabb3485 100644 --- a/src/input.rs +++ b/src/input.rs @@ -34,8 +34,6 @@ use term::SizeInfo; use term::mode::{self, TermMode}; use util::fmt::Red; -const SCROLL_MULTIPLIER: usize = 3; - /// Processes input from glutin. /// /// An escape sequence may be emitted in case specific keys or key combinations @@ -399,8 +397,9 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 65 }; + let scrolling_multiplier = self.mouse_config.normal_scrolling_lines; for _ in 0..(to_scroll.abs() as usize) { - self.scroll_terminal(mouse_modes, code, modifiers, SCROLL_MULTIPLIER) + self.scroll_terminal(mouse_modes, code, modifiers, scrolling_multiplier) } self.ctx.mouse_mut().lines_scrolled = to_scroll % 1.0; @@ -433,10 +432,10 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } } - fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8, modifiers: ModifiersState, scroll_multiplier: usize) { + fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8, modifiers: ModifiersState, scroll_multiplier: u8) { debug_assert!(code == 64 || code == 65); - let faux_scrollback_lines = self.mouse_config.faux_scrollback_lines; + let faux_scrollback_lines = self.mouse_config.faux_scrollback_lines as usize; if self.ctx.terminal_mode().intersects(mouse_modes) { self.mouse_report(code, ElementState::Pressed); } else if self.ctx.terminal_mode().contains(TermMode::ALT_SCREEN) |