summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index cd01187b..93ea1016 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -993,6 +993,16 @@ pub const Pardes = struct {
drag: Drag = .none,
hover_col: u16 = 0,
hover_row: u16 = 0,
+ /// touchpad drift guard, counted down in horizontal wheel ticks — see
+ /// config.wheelTick, which owns the whole rule. Global, and clock-free on
+ /// purpose: the core has no clock, so "recently scrolled vertically" can
+ /// only mean "in the last few wheel events", which is all the heuristic
+ /// needs.
+ /// ponytail: it therefore never times out — only a horizontal tick spends
+ /// it, so a sideways swipe an hour after a scroll still pays the toll. If
+ /// that ever bites, clear it on any non-wheel event: a keypress or a click
+ /// is proof the gesture ended, and still needs no clock.
+ wheel_guard: u8 = 0,
ctrl_w_pending: bool = false,
/// SPC leader in flight, holding the key path typed so far (empty = just
/// SPC). Global like ctrl_w_pending — there is one leader and it acts on
@@ -4292,11 +4302,19 @@ pub const Pardes = struct {
.none => {}, // hover tracked above; motion has no other meaning
.wheel_up, .wheel_down => {
if (m.kind != .press) return;
+ // re-arms the drift guard below; vertical always scrolls, so
+ // the answer is never in doubt here
+ _ = config.wheelTick(&p.wheel_guard, true);
const id = hovered orelse return;
p.panes[id].?.scrollBy(if (m.button == .wheel_up) -config.wheel_rows else config.wheel_rows);
},
.wheel_left, .wheel_right => {
if (m.kind != .press) return;
+ // a mostly-vertical two-finger swipe's sideways drift dies
+ // here rather than sliding the view out from under a scroll.
+ // Charged against the gesture, not the pane, so it runs before
+ // we ask what is hovered.
+ if (!config.wheelTick(&p.wheel_guard, false)) return;
const id = hovered orelse return;
const pane = p.panes[id].?;
// ponytail: no right clamp — overscroll shows blank and the