diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 23:47:50 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 23:47:50 -0300 |
| commit | d236dff22567c2f563756695598678afb84fbef4 (patch) | |
| tree | 11c5ed3c0d696587e49bf8ec5a8b2a696d5be718 /core/rollback.zig | |
| parent | 9d4c94f03c5e34933e80e1069c16df74c2631965 (diff) | |
| parent | 165f1f61a20dd95a9018177d66e6f4f40a4cb320 (diff) | |
| download | pardes-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
Diffstat (limited to 'core/rollback.zig')
| -rw-r--r-- | core/rollback.zig | 10 |
1 files changed, 10 insertions, 0 deletions
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)); |
