From 6cd33661064df4163f3bd98db432526ad2165b7f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 31 Jul 2026 03:15:28 -0300 Subject: a mostly-vertical touchpad swipe stays vertical MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pad faithfully turns a two-finger scroll's sideways drift into wheel_left and wheel_right, so a plain scroll slid the view sideways underneath you. Every vertical tick now re-arms a guard and every horizontal tick spends one instead of scrolling, so horizontal has to EARN its way back by landing three ticks in a row with no vertical among them. Clock-free on purpose: the core is a state machine with no timestamp on a mouse event, and faking one by counting renders would be worse than the counter. The guard is only ever armed BY vertical scrolling, so a horizontal swipe from a still view still moves on its first tick — only horizontal that interrupts vertical has anything to prove. A tilt wheel gets the same treatment, where recent-vertical is a much weaker signal of accident. Deliberate: the only honest fix is a per-device flag out of the shell, and that layer costs more than the three clicks it would save. The rule is one pure function next to the number it reads, with an inline test written to hold for any tuning of that number. unit-test grew a fourth binary over the core module hxdiff already links. New golden wheeldrift; none moved. --- build.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 04516cc8..e5a63532 100644 --- a/build.zig +++ b/build.zig @@ -668,7 +668,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .root_source_file = b.path("src/modal.zig"), }) }); - const unit_step = b.step("unit-test", "run the modal.zig + crt.zig + deck replay unit tests"); + const unit_step = b.step("unit-test", "run the modal.zig + crt.zig + deck replay + core unit tests"); unit_step.dependOn(&b.addRunArtifact(unit).step); // crt.zig is pure std — the mouse-mapping-vs-shader-formula test const crt_test = b.addTest(.{ .root_module = b.createModule(.{ @@ -690,6 +690,12 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("src/gui/deck.zig"), })); unit_step.dependOn(&b.addRunArtifact(deck_test).step); + // the core's own inline tests (config.zig's wheel drift guard). It + // links the SAME module hxdiff does rather than a fourth hand-wired + // copy of ghostty-vt/tree-sitter/zstbi — a second wiring of that graph + // is a second thing to keep in step. + const core_test = b.addTest(.{ .root_module = hx_core_mod }); + unit_step.dependOn(&b.addRunArtifact(core_test).step); } } -- cgit v1.3