diff options
author | Christian Duerr <contact@christianduerr.com> | 2017-12-18 20:35:57 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-12-22 14:00:17 -0800 |
commit | 09b78dc80aef625dcf0796a59da33e7fdb94ba78 (patch) | |
tree | 6fc0f198e89fec19d94fdca65f493ed305757684 /src | |
parent | 14884deba7ff61495a87cd3be91dc620a1eba5fa (diff) | |
download | alacritty-09b78dc80aef625dcf0796a59da33e7fdb94ba78.tar.gz alacritty-09b78dc80aef625dcf0796a59da33e7fdb94ba78.zip |
Adapt pixel-based scrolling behavior
The pixel-based scrolling behavior has been adapted to be as similar to
the line-based one as possible.
I still have not been able to test this. But this should have a decent
chance to at least kinda work.
Diffstat (limited to 'src')
-rw-r--r-- | src/input.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/input.rs b/src/input.rs index c653d486..7521409c 100644 --- a/src/input.rs +++ b/src/input.rs @@ -407,24 +407,24 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { let height = self.ctx.size_info().cell_height as i32; while self.ctx.mouse_mut().scroll_px.abs() >= height { + let button = if self.ctx.mouse_mut().scroll_px > 0 { + self.ctx.mouse_mut().scroll_px -= height; + 64 + } else { + self.ctx.mouse_mut().scroll_px += height; + 65 + }; + if self.ctx.terminal_mode().intersects(mode::ALT_SCREEN_BUF) { // Faux scrolling - if self.ctx.mouse_mut().scroll_px > 0 { - // Scroll up three lines - self.ctx.write_to_pty("\x1bOA\x1bOA\x1bOA".as_bytes()); + if button == 64 { + // Scroll up one line + self.ctx.write_to_pty("\x1bOA".as_bytes()); } else { - // Scroll down three lines - self.ctx.write_to_pty("\x1bOB\x1bOB\x1bOB".as_bytes()); + // Scroll down one line + self.ctx.write_to_pty("\x1bOB".as_bytes()); } } else { - let button = if self.ctx.mouse_mut().scroll_px > 0 { - self.ctx.mouse_mut().scroll_px -= height; - 64 - } else { - self.ctx.mouse_mut().scroll_px += height; - 65 - }; - self.normal_mouse_report(button); } } |