From c1e87e712211e098ea0f392aa1e25805d533a239 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Sun, 2 Mar 2025 08:35:25 -0600 Subject: [PATCH] scroll: only use multiplier for non-precision scrolls Precision scrolls don't require a multiplier to behave nicely. However, wheel scrolls feel extremely slow without one. We apply the multiplier to wheel scrolls only --- src/Surface.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 37b24160d..f75017053 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -2432,6 +2432,12 @@ pub fn scrollCallback( try self.setSelection(null); } + // We never use a multiplier for precision scrolls. + const multiplier: f64 = if (scroll_mods.precision) + 1.0 + else + self.config.mouse_scroll_multiplier; + // If we're in alternate screen with alternate scroll enabled, then // we convert to cursor keys. This only happens if we're: // (1) alt screen (2) no explicit mouse reporting and (3) alt @@ -2459,7 +2465,7 @@ pub fn scrollCallback( }; }; // We multiple by the scroll multiplier when reporting arrows - const multiplied = y.multiplied(self.config.mouse_scroll_multiplier); + const multiplied = y.multiplied(multiplier); for (0..multiplied.magnitude()) |_| { self.io.queueMessage(.{ .write_stable = seq }, .locked); } @@ -2497,7 +2503,7 @@ pub fn scrollCallback( if (y.delta != 0) { // We multiply by the multiplier when scrolling the viewport - const multiplied = y.multiplied(self.config.mouse_scroll_multiplier); + const multiplied = y.multiplied(multiplier); // Modify our viewport, this requires a lock since it affects // rendering. We have to switch signs here because our delta // is negative down but our viewport is positive down.