summaryrefslogtreecommitdiff
path: root/core/mouse.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 19:55:02 -0300
committerGabriel Schneider <[email protected]>2026-11-19 19:55:02 -0300
commit2ab05b536bc3b063666b5aaab497157adc2a9120 (patch)
tree4b796e6abaf7658294d2b6cbb5d35e0210b88b40 /core/mouse.zig
parente4f99d2370c8b44e76b541826d91356d86090f53 (diff)
parent786cddd24e2be36d30847300075cec8c45d1b0ca (diff)
downloadpardes-2ab05b536bc3b063666b5aaab497157adc2a9120.tar.gz
pardes-2ab05b536bc3b063666b5aaab497157adc2a9120.zip
integration: the regular-expression fixes with the fixes the real loops asked for: pardes-regex-2 (mvzr's reads past a pattern cut short patched as it is fetched; the leak of a pattern that does not compile; the soak's corpus check comparing what is visible) and pardes-draw-2 (a step's notice bands and a markdown text's tables made from the step's own state, never from the last frame; a load under way in another live process no crash; an idle pair silent), merged without a conflict; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/mouse.zig')
-rw-r--r--core/mouse.zig44
1 files changed, 44 insertions, 0 deletions
diff --git a/core/mouse.zig b/core/mouse.zig
index 6fb97787..5707cb57 100644
--- a/core/mouse.zig
+++ b/core/mouse.zig
@@ -1769,6 +1769,50 @@ test "a tag press is the same state whichever frame this process drew last" {
try expectSame(two.a, two.b, "after the press");
}
+// A notice band over a body's top rows is derived (Pane.notices): a frame
+// writes it at its own time, so a step makes it again as its state stands
+// before it reads it. Here the session draws a frame once Del's question is
+// due (its band shown) and the replica none: a press on the band's chip is
+// the same in both (the soak's divergence, through `kindMouse`, was this read).
+test "a press on a notice's chip is the same state whichever frame this process drew last" {
+ const gpa = std.testing.allocator;
+ const a = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 40 });
+ defer a.deinit();
+ a.update(.{ .resize = .{ .cols = 80, .rows = 40, .row_metrics = test_metrics } });
+ // Del asks which neighbour takes the rows of a pane with two.
+ a.newScratchBelow(a.view().active);
+ const mid = a.view().active;
+ a.newScratchBelow(mid);
+ a.view().active = mid;
+ a.sync();
+ const bytes = try pardes.dump.dumpBytes(a);
+ defer gpa.free(bytes);
+ const b = try pardes.dump.load(gpa, a.opts, bytes, null);
+ defer b.deinit();
+ for ([_]*Pardes{ a, b }) |p| {
+ p.clock.now_ns = 5 * std.time.ns_per_s;
+ p.clock.stepped_ns = p.clock.now_ns;
+ p.update(.{ .key = .{ .cp = ' ' } });
+ p.update(.{ .key = .{ .cp = 'd' } });
+ p.clock.now_ns = p.panes[mid].?.question_due_ns;
+ }
+ var frame: std.heap.ArenaAllocator = .init(gpa);
+ defer frame.deinit();
+ _ = try a.render(frame.allocator());
+ const pane = a.panes[mid].?;
+ try std.testing.expect(pane.notices.len > 0);
+ const last = pane.notices.len - 1;
+ try std.testing.expectEqual(Pane.Notices.Kind.prompt, pane.notices.kinds[last]);
+ const row = a.bodyTop(pane, a.view().rects[mid]) + pane.notices.row[last];
+ const press: pardes.Event = .{ .mouse = .{ .button = .left, .kind = .press, .col = pane.notices.left[last] + 1, .row = row } };
+ a.update(press);
+ b.update(press);
+ // What the press did (a pane's cwd and a message's wall-clock stamp
+ // differ between two cores in one test process: not compared).
+ try std.testing.expectEqual(a.view().drag, b.view().drag);
+ try std.testing.expectEqual(a.panes[mid].?.sel[0], b.panes[mid].?.sel[0]);
+}
+
// The same through a body hit (edit.pointerTextSelection, a sweep's drag),
// on a compact body layer (TreeContext), which a pixel shell inverts.
test "a body press, drag and release are the same state whichever frame this process drew last" {