diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-03-09 11:17:47 +0100 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 09:40:07 -0700 |
commit | 9a5a0ec546f4cbb6206c4c7cc9900211a3bbefa5 (patch) | |
tree | 98bddc5ff6be2c8256f3cf902ede040d1d0cf030 /src/input.rs | |
parent | 04086186a00d50f22a7e1914d89a8dd1beb695cc (diff) | |
download | alacritty-9a5a0ec546f4cbb6206c4c7cc9900211a3bbefa5.tar.gz alacritty-9a5a0ec546f4cbb6206c4c7cc9900211a3bbefa5.zip |
Add faux_scrolling back to scrollback
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/input.rs b/src/input.rs index ad9fcd39..1974a348 100644 --- a/src/input.rs +++ b/src/input.rs @@ -441,8 +441,8 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 65 }; - for _ in 0..(to_scroll.abs() as usize * SCROLL_MULTIPLIER) { - self.scroll_terminal(code, modifiers) + for _ in 0..(to_scroll.abs() as usize) { + self.scroll_terminal(code, modifiers, SCROLL_MULTIPLIER) } self.ctx.mouse_mut().lines_scrolled = to_scroll % 1.0; @@ -466,7 +466,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 65 }; - self.scroll_terminal(code, modifiers) + self.scroll_terminal(code, modifiers, 1) } }, _ => (), @@ -475,26 +475,29 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } } - fn scroll_terminal(&mut self, code: u8, modifiers: ModifiersState) { + fn scroll_terminal(&mut self, code: u8, modifiers: ModifiersState, scroll_multiplier: usize) { debug_assert!(code == 64 || code == 65); let faux_scrollback_lines = self.mouse_config.faux_scrollback_lines; let mouse_modes = TermMode::MOUSE_REPORT_CLICK | TermMode::MOUSE_DRAG | TermMode::MOUSE_MOTION; if self.ctx.terminal_mode().intersects(mouse_modes) { self.mouse_report(code, ElementState::Pressed, modifiers); - // } else if faux_scrollback_lines > 0 { - // // Faux scrolling - // let cmd = code + 1; // 64 + 1 = A, 65 + 1 = B - // let mut content = Vec::with_capacity(faux_scrollback_lines * 3); - // for _ in 0..faux_scrollback_lines { - // content.push(0x1b); - // content.push(b'O'); - // content.push(cmd); - // } - // self.ctx.write_to_pty(content); - // } + } else if self.ctx.terminal_mode().contains(TermMode::ALT_SCREEN) + && faux_scrollback_lines > 0 + { + // Faux scrolling + let cmd = code + 1; // 64 + 1 = A, 65 + 1 = B + let mut content = Vec::with_capacity(faux_scrollback_lines * 3); + for _ in 0..faux_scrollback_lines { + content.push(0x1b); + content.push(b'O'); + content.push(cmd); + } + self.ctx.write_to_pty(content); } else { - self.ctx.scroll(-((code as isize) * 2 - 129)); + for _ in 0..scroll_multiplier { + self.ctx.scroll(-((code as isize) * 2 - 129)); + } } } |