mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 17:26:09 +03:00
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
This commit is contained in:
@ -2432,6 +2432,12 @@ pub fn scrollCallback(
|
|||||||
try self.setSelection(null);
|
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
|
// If we're in alternate screen with alternate scroll enabled, then
|
||||||
// we convert to cursor keys. This only happens if we're:
|
// we convert to cursor keys. This only happens if we're:
|
||||||
// (1) alt screen (2) no explicit mouse reporting and (3) alt
|
// (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
|
// 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()) |_| {
|
for (0..multiplied.magnitude()) |_| {
|
||||||
self.io.queueMessage(.{ .write_stable = seq }, .locked);
|
self.io.queueMessage(.{ .write_stable = seq }, .locked);
|
||||||
}
|
}
|
||||||
@ -2497,7 +2503,7 @@ pub fn scrollCallback(
|
|||||||
|
|
||||||
if (y.delta != 0) {
|
if (y.delta != 0) {
|
||||||
// We multiply by the multiplier when scrolling the viewport
|
// 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
|
// Modify our viewport, this requires a lock since it affects
|
||||||
// rendering. We have to switch signs here because our delta
|
// rendering. We have to switch signs here because our delta
|
||||||
// is negative down but our viewport is positive down.
|
// is negative down but our viewport is positive down.
|
||||||
|
Reference in New Issue
Block a user