diff options
author | Joe Wilm <joe@jwilm.com> | 2018-02-15 18:35:49 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-06-02 09:32:29 -0700 |
commit | 45c2b3fbf72fa6dfd36bee590e64314c6da7c6c2 (patch) | |
tree | 9f68a9692d0d0754264931d26e1a7cf0400471ed /src/input.rs | |
parent | 94796a70fcbc11df2dc642057fef242466822067 (diff) | |
download | alacritty-45c2b3fbf72fa6dfd36bee590e64314c6da7c6c2.tar.gz alacritty-45c2b3fbf72fa6dfd36bee590e64314c6da7c6c2.zip |
checkpoint: very basic scrolling works
Things that do not work
- Limiting how far back in the buffer it's possible to scroll
- Selections (need to transform to buffer offsets)
Diffstat (limited to 'src/input.rs')
-rw-r--r-- | src/input.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/input.rs b/src/input.rs index 2d603783..2e345c2a 100644 --- a/src/input.rs +++ b/src/input.rs @@ -64,6 +64,7 @@ pub trait ActionContext { fn last_modifiers(&mut self) -> &mut ModifiersState; fn change_font_size(&mut self, delta: i8); fn reset_font_size(&mut self); + fn scroll(&mut self, count: isize) {} } /// Describes a state and action to take in that state @@ -428,10 +429,6 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { pub fn on_mouse_wheel(&mut self, delta: MouseScrollDelta, phase: TouchPhase, modifiers: ModifiersState) { let mouse_modes = TermMode::MOUSE_REPORT_CLICK | TermMode::MOUSE_DRAG | TermMode::MOUSE_MOTION; - if !self.ctx.terminal_mode().intersects(mouse_modes | TermMode::ALT_SCREEN) { - return; - } - match delta { MouseScrollDelta::LineDelta(_columns, lines) => { let to_scroll = self.ctx.mouse_mut().lines_scrolled + lines; @@ -482,16 +479,19 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 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 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)); } } |