From 3d26d3c68ac28aade9377109f897c85b147ddfa6 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Sun, 11 Dec 2016 20:00:00 -0800 Subject: [PATCH] Implement mouse scrolling with line deltas This makes scrolling work for mouse wheels (was previously just trackpads). --- src/input.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/input.rs b/src/input.rs index 796e0fb5..994b2f1b 100644 --- a/src/input.rs +++ b/src/input.rs @@ -305,8 +305,16 @@ impl Processor { terminal: &Term ) { match delta { - MouseScrollDelta::LineDelta(_columns, _lines) => { - unimplemented!(); + MouseScrollDelta::LineDelta(_columns, lines) => { + let code = if lines > 0.0 { + 64 + } else { + 65 + }; + + for _ in 0..(lines.abs() as usize) { + self.mouse_report(code, notifier, terminal); + } }, MouseScrollDelta::PixelDelta(_x, y) => { match phase {