diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-03-09 11:17:47 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2018-03-12 22:55:57 -0700 |
commit | f8c833ea6676d620a283f4dbea0834459949aad1 (patch) | |
tree | fdbf2417e7a2a4f5f36ece7e80c7785f5bd0d7bc | |
parent | e472aa0cb4d8072dd559633a0c84cc50bdb07693 (diff) | |
download | alacritty-f8c833ea6676d620a283f4dbea0834459949aad1.tar.gz alacritty-f8c833ea6676d620a283f4dbea0834459949aad1.zip |
Add faux_scrolling back to scrollback
-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 59cecea4..da89a58f 100644 --- a/src/input.rs +++ b/src/input.rs @@ -399,8 +399,8 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 65 }; - for _ in 0..(to_scroll.abs() as usize * SCROLL_MULTIPLIER) { - self.scroll_terminal(mouse_modes, code) + for _ in 0..(to_scroll.abs() as usize) { + self.scroll_terminal(mouse_modes, code, SCROLL_MULTIPLIER) } self.ctx.mouse_mut().lines_scrolled = to_scroll % 1.0; @@ -424,7 +424,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 65 }; - self.scroll_terminal(mouse_modes, code) + self.scroll_terminal(mouse_modes, code, 1) } }, _ => (), @@ -433,25 +433,28 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } } - fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8) { + fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8, scroll_multiplier: usize) { debug_assert!(code == 64 || code == 65); let faux_scrollback_lines = self.mouse_config.faux_scrollback_lines; if self.ctx.terminal_mode().intersects(mouse_modes) { self.mouse_report(code, ElementState::Pressed); - // } 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)); + } } } |