diff options
author | Joe Wilm <joe@jwilm.com> | 2018-02-15 18:35:49 -0800 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2018-03-07 09:47:21 -0800 |
commit | cfc4ebfd6a2fb39ae98ba37c215a4a9141865e01 (patch) | |
tree | 604b757b2d0f2754359a73b2bf682e6e5d0650ed /src/input.rs | |
parent | 6d1d41f8c77968547b43603db51a5efeac21a400 (diff) | |
download | alacritty-cfc4ebfd6a2fb39ae98ba37c215a4a9141865e01.tar.gz alacritty-cfc4ebfd6a2fb39ae98ba37c215a4a9141865e01.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 ff1eb796..6ffdd507 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 @@ -386,10 +387,6 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { pub fn on_mouse_wheel(&mut self, delta: MouseScrollDelta, phase: TouchPhase) { let mouse_modes = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION | mode::TermMode::SGR_MOUSE; - if !self.ctx.terminal_mode().intersects(mouse_modes | mode::TermMode::ALT_SCREEN) { - return; - } - match delta { MouseScrollDelta::LineDelta(_columns, lines) => { let to_scroll = self.ctx.mouse_mut().lines_scrolled + lines; @@ -439,16 +436,19 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 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 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)); } } |