summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 23:47:50 -0300
committerGabriel Schneider <[email protected]>2026-11-19 23:47:50 -0300
commitd236dff22567c2f563756695598678afb84fbef4 (patch)
tree11c5ed3c0d696587e49bf8ec5a8b2a696d5be718
parent9d4c94f03c5e34933e80e1069c16df74c2631965 (diff)
parent165f1f61a20dd95a9018177d66e6f4f40a4cb320 (diff)
downloadpardes-d236dff22567c2f563756695598678afb84fbef4.tar.gz
pardes-d236dff22567c2f563756695598678afb84fbef4.zip
integration: the documents as the tree is, with tests that do not depend on the load or the clock's second: pardes-docs (six changes of documents and the changelog) and pardes-test-robust (the corpus's click in one write, the two clock-second core tests, winch, headersweep and grep waiting on what they need, and the language server's false "still loading" message), merged without a conflict on pardes-merge22; tui core-test 848/991 (143 skipped), shell-test 1027/1030
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
-rw-r--r--core/Places.zig3
-rw-r--r--core/rollback.zig10
-rw-r--r--dev/lsp/lsp_client.zig9
-rw-r--r--test/process/tty_boot.zig15
-rw-r--r--test/process/tty_editing.zig6
-rw-r--r--test/process/window.zig7
-rw-r--r--test/snapshots/grep.golden2
7 files changed, 43 insertions, 9 deletions
diff --git a/core/Places.zig b/core/Places.zig
index 1416dbd3..9ffbff88 100644
--- a/core/Places.zig
+++ b/core/Places.zig
@@ -890,5 +890,8 @@ test "a session's places loaded from its dump find what an edit makes as the ses
pn.places.fill(p, pn, 0, frame_steps);
try std.testing.expectEqual(@as(usize, 3), pn.places.hits.items.len);
}
+ // An edit stamps the text with the wall clock's second (File.edit's
+ // mtime): the two cores' edits, a moment apart, can fall in two.
+ b.panes[b.view().active].?.file.?.mtime = a.panes[a.view().active].?.file.?.mtime;
try std.testing.expectEqual(pardes.walk.digest(Pardes, a), pardes.walk.digest(Pardes, b));
}
diff --git a/core/rollback.zig b/core/rollback.zig
index 3d5ab921..c7d0a4e8 100644
--- a/core/rollback.zig
+++ b/core/rollback.zig
@@ -88,6 +88,9 @@ pub const Epoch = struct {
}
pub fn deinit(e: *Epoch) void {
+ // Gone with a copy still held (a test that failed between take and
+ // restore): the process-wide hold must not point into it.
+ if (pardes.syntax.held_trees == &e.trees) pardes.syntax.held_trees = null;
var it = e.live.iterator();
while (it.next()) |kv| e.child.rawFree(@as([*]u8, @ptrFromInt(kv.key_ptr.*))[0..kv.value_ptr.len], kv.value_ptr.alignment, @returnAddress());
e.live.deinit(e.meta);
@@ -579,6 +582,9 @@ test "a copy put back is the core as it was; one let go keeps what was done" {
const gpa = e.allocator();
const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml", .image_allocator = gpa, .tree_sitter_allocator = gpa, .frame_allocator = gpa });
p.pump(.{}) catch {};
+ const f = for (p.panes) |slot| {
+ if (slot) |pane| if (pane.file) |*file| break file;
+ } else return error.NoFile;
const before = walk.digest(Pardes, p);
var c: Copy = .{};
defer c.deinit();
@@ -588,6 +594,7 @@ test "a copy put back is the core as it was; one let go keeps what was done" {
p.update(.{ .key = .{ .cp = pardes.Key.escape } });
p.pump(.{}) catch {};
const edited = walk.digest(Pardes, p);
+ const stamped = f.mtime;
try std.testing.expect(edited != before);
try std.testing.expect(c.restore());
try std.testing.expectEqual(before, walk.digest(Pardes, p));
@@ -596,6 +603,9 @@ test "a copy put back is the core as it was; one let go keeps what was done" {
for (typed) |k| p.update(.{ .key = .{ .cp = k, .text = &.{k} } });
p.update(.{ .key = .{ .cp = pardes.Key.escape } });
p.pump(.{}) catch {};
+ // An edit stamps the text with the wall clock's second (File.edit's
+ // mtime): the same typing in the next second is the same edit.
+ f.mtime = stamped;
try std.testing.expectEqual(edited, walk.digest(Pardes, p));
c.release();
try std.testing.expectEqual(edited, walk.digest(Pardes, p));
diff --git a/dev/lsp/lsp_client.zig b/dev/lsp/lsp_client.zig
index 83aea44f..4ad8dace 100644
--- a/dev/lsp/lsp_client.zig
+++ b/dev/lsp/lsp_client.zig
@@ -783,8 +783,13 @@ fn answer(io: std.Io, arena: std.mem.Allocator, si: usize, req: lsp.Req, out: *s
if (!try timedWait(c, io, startup_deadline)) break;
}
if (starting or c.loading or c.progress > 0) {
- tr.note("{s} is still loading: waiting for it, then asking again", .{specs[si].name});
- post(si, .always, "{s} is still loading the workspace; the answer comes when it is done\u{2026}", .{specs[si].name});
+ // Said only when the server says it: a startup window that ran
+ // out with no word of loading is asked again quietly, and the
+ // message row keeps what it had (an empty answer is an answer).
+ if (c.loading or c.progress > 0) {
+ tr.note("{s} is still loading: waiting for it, then asking again", .{specs[si].name});
+ post(si, .always, "{s} is still loading the workspace; the answer comes when it is done\u{2026}", .{specs[si].name});
+ }
while ((c.loading or c.progress > 0) and c.gen == g and c.alive()) _ = try timedWait(c, io, nowMs() + 500);
out.end = before;
try attempt(c, io, si, arena, req, out, tr, g);
diff --git a/test/process/tty_boot.zig b/test/process/tty_boot.zig
index a5f42074..741f6260 100644
--- a/test/process/tty_boot.zig
+++ b/test/process/tty_boot.zig
@@ -300,6 +300,9 @@ fn restore(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
// when it comes up. Both headers used to run the word under the PRESS, on
// the press, so a sweep of `echo SWEPT-COL` ran a bare `echo`. A right sweep
// looks for what it swept the same way, and the other button cancels.
+// What a sweep ran is waited for in its pane's tag, `(echo SW''EPT-COL) exit
+// 0`, which stays: the echo's line shows in the pane's one body row only
+// until `exit 0` follows it, and a loaded machine draws both in one frame.
fn headersweep(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
var t = try Tty.init(gpa, exe, "headersweep");
defer t.deinit();
@@ -321,7 +324,7 @@ fn headersweep(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.style("col-sweeping");
try t.drag("middle", "@echo+16", 2);
try t.release("middle", "@echo+16", 2);
- try t.wait(8000, "SWEPT-COL");
+ try t.wait(8000, "EPT-COL) exit 0");
try t.stable(700, 15000);
try t.snap("col-swept");
// the workspace tag, the same
@@ -335,7 +338,7 @@ fn headersweep(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.press("middle", "@echo", 1);
try t.drag("middle", "@echo+15", 1);
try t.release("middle", "@echo+15", 1);
- try t.wait(8000, "SWEPT-WS");
+ try t.wait(8000, "EPT-WS) exit 0");
try t.stable(700, 15000);
try t.snap("ws-swept");
// a right sweep over part of a word looks for the part: `hay.txt` opens,
@@ -399,7 +402,7 @@ fn headersweep_restored(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.style("col-sweeping");
try t.drag("middle", "@echo+19", 2);
try t.release("middle", "@echo+19", 2);
- try t.wait(8000, "RESTORED-COL");
+ try t.wait(8000, "-COL) exit 0");
try t.stable(700, 15000);
try t.snap("col-swept");
try t.press("left", "118", 1);
@@ -415,7 +418,7 @@ fn headersweep_restored(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.style("ws-sweeping");
try t.drag("middle", "@echo+18", 1);
try t.release("middle", "@echo+18", 1);
- try t.wait(8000, "RESTORED-WS");
+ try t.wait(8000, "-WS) exit 0");
try t.stable(700, 15000);
try t.snap("ws-swept");
try t.done();
@@ -869,6 +872,10 @@ fn winch(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.start(31, 100, &.{ "-n", "3" });
try t.stable(700, 20000);
try t.key("c-b");
+ // Its shell at its prompt after its `ls` (a row of the 50-column pane
+ // holding `$` alone): typed into earlier, a loaded machine's bash echoed
+ // the line before its readline was up, or ran it before the `ls`.
+ try t.wait(20000, "\n $" ++ @as([47]u8, @splat(' ')));
try t.stable(600, 8000);
try t.send("for i in $(seq 600); do kill -WINCH $PPID; done; echo SUR''VIVED");
try t.key("enter");
diff --git a/test/process/tty_editing.zig b/test/process/tty_editing.zig
index b5f0495c..63c75512 100644
--- a/test/process/tty_editing.zig
+++ b/test/process/tty_editing.zig
@@ -783,6 +783,12 @@ fn grep(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try t.key("g");
try t.stable(400, 5000);
try t.send("zzqq");
+ // Its count once the search is over (`0`): `0+` is while it still
+ // counts (its pause on the clock, then the worker), which a quiet
+ // machine's frame shows and a loaded one's not. The query typed in
+ // first: the pane's empty query counts `0` too.
+ try t.wait(10000, "Grep zzqq");
+ try t.wait(10000, "+Search 0 ");
try t.stable(700, 10000);
try t.snap("nomatch");
try t.key("esc");
diff --git a/test/process/window.zig b/test/process/window.zig
index 687b9000..00450a9b 100644
--- a/test/process/window.zig
+++ b/test/process/window.zig
@@ -426,8 +426,11 @@ fn corpus(gpa: std.mem.Allocator, exe: [:0]const u8) !void {
try d.mouse("wheel", -3, cell_w * 40, cell_h * 12);
try k.keep(&d, from, "11 a wheel's glide, every frame", true);
from = try k.mark(&d);
- try d.mouse("down", 1, cell_w * 20, cell_h * 10);
- try d.mouse("up", 1, cell_w * 20, cell_h * 10);
+ // The press and its release in one write (Detached.mouse's events),
+ // so the window reads them in one pass: written apart, a loaded
+ // machine let it read the press alone and draw a frame between, one
+ // more kept frame than the base's (78) and every one after shifted.
+ try d.typeKeys(f.at("\x1b]777;mouse;down;1;{d};{d}\x07\x1b]777;mouse;up;1;{d};{d}\x07", .{ cell_w * 20, cell_h * 10, cell_w * 20, cell_h * 10 }));
try k.keep(&d, from, "11 a click moves the caret, every frame", true);
from = try k.mark(&d);
try d.typeKeys("gg");
diff --git a/test/snapshots/grep.golden b/test/snapshots/grep.golden
index 30c8612c..1d8d21ad 100644
--- a/test/snapshots/grep.golden
+++ b/test/snapshots/grep.golden
@@ -39,7 +39,7 @@
|9: +Search 3/3 Save Unattach Del
|13: /tmp/pardes-snap/grep/cwd/sub/b.txt Save Term Collapse Follow Del
== snap nomatch grid=180x31 cursor=11,15
-|14: ^ +Search 0+ Del
+|14: ^ +Search 0 Del
|15: Grep zzqq
== snap esc grid=180x31 cursor=12,15
|14: 1 deep