aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2018-03-09 23:09:42 +0100
committerJoe Wilm <jwilm@users.noreply.github.com>2018-03-12 22:55:57 -0700
commit8dd6f5c791645e2a3fbc45a55860fac7dab54514 (patch)
tree795326ecf221402b7a56121e5a4bb19190c627ff
parentf8c833ea6676d620a283f4dbea0834459949aad1 (diff)
downloadalacritty-8dd6f5c791645e2a3fbc45a55860fac7dab54514.tar.gz
alacritty-8dd6f5c791645e2a3fbc45a55860fac7dab54514.zip
Disable faux scrolling when shift is pressed
To make it possible to access the native scrollback buffer in the alternate screen without having to disable faux scrolling, faux scrolling is now disabled when the `shift` key is held down. This should allow alacritty to have the best of both worlds, a native scrollback buffer in the alternate screen buffer and faux scrolling.
-rw-r--r--src/event.rs4
-rw-r--r--src/input.rs10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/event.rs b/src/event.rs
index 37a17f58..04176963 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -317,9 +317,9 @@ impl<N: Notify> Processor<N> {
*hide_cursor = false;
processor.mouse_moved(x as u32, y as u32, modifiers);
},
- MouseWheel { delta, phase, .. } => {
+ MouseWheel { delta, phase, modifiers, .. } => {
*hide_cursor = false;
- processor.on_mouse_wheel(delta, phase);
+ processor.on_mouse_wheel(delta, phase, modifiers);
},
Refresh => {
processor.ctx.terminal.dirty = true;
diff --git a/src/input.rs b/src/input.rs
index da89a58f..f7514d11 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -388,7 +388,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
self.ctx.copy_selection(Buffer::Selection);
}
- pub fn on_mouse_wheel(&mut self, delta: MouseScrollDelta, phase: TouchPhase) {
+ pub fn on_mouse_wheel(&mut self, delta: MouseScrollDelta, phase: TouchPhase, modifiers: ModifiersState) {
let mouse_modes = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION | mode::TermMode::SGR_MOUSE;
match delta {
MouseScrollDelta::LineDelta(_columns, lines) => {
@@ -400,7 +400,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
};
for _ in 0..(to_scroll.abs() as usize) {
- self.scroll_terminal(mouse_modes, code, SCROLL_MULTIPLIER)
+ self.scroll_terminal(mouse_modes, code, modifiers, 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, 1)
+ self.scroll_terminal(mouse_modes, code, modifiers, 1)
}
},
_ => (),
@@ -433,14 +433,14 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
}
}
- fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8, scroll_multiplier: usize) {
+ fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8, modifiers: ModifiersState, 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 self.ctx.terminal_mode().contains(TermMode::ALT_SCREEN)
- && faux_scrollback_lines > 0
+ && faux_scrollback_lines > 0 && !modifiers.shift
{
// Faux scrolling
let cmd = code + 1; // 64 + 1 = A, 65 + 1 = B