diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 05:17:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 05:17:57 -0300 |
| commit | 61c40ab7cffc64a11cb5e874eec9568ed06ad95b (patch) | |
| tree | 5fdff15af9c53694ccdb8df946bf9fd8d6de0208 /core | |
| parent | 7611e1bb7a1c3eda2f4ac463881f543653abd035 (diff) | |
| download | pardes-61c40ab7cffc64a11cb5e874eec9568ed06ad95b.tar.gz pardes-61c40ab7cffc64a11cb5e874eec9568ed06ad95b.zip | |
Trail, panes, test/process/window: a pane keeps its number when it walks to another file (walk UI P3 item 5, the coordinator's R9): Trail.show stepped a reading pane in place by opening the new file as a new pane in a free slot, so it took a new serial (B's decision) and `@pN` words, a 9P script holding /pane/N (the frame corpus died on `/pane/N/look: NotFound` and ran under `Jumps new-pane`) and /log's followers (a `del` and a `new`) all lost it; NOW the pane is the same pane on another file, as acme's Get keeps a window's id: the new file's pane takes the old serial and its 9P state (std.mem.swap of `fs`: the opens' event queue, readers, ranges; the old one, never announced, leaves with no record), /log hears `rename N path`, Recent the file opened (the one it left is noted closed with its place, as any close), what jj answered for the file it left goes with it (jj.forget at the step; panes.teardownPane forgets a serial only when no live pane has it), and its text's revision is the left one's plus one, so a worker's parse or paint asked of the old text (both keyed by serial and revision) never lands on the new; the frame corpus (test/process/window.zig) runs under the walk default again: its file pane's Look at notes.md steps it in place and a Look at shapes.zig walks it back where it Del'd notes.md; TEST FIRST: test/behaviour/look_and_exec.zig "a reading pane that walks to another file is the same pane: its number, an open of its files reading the new text, /log's rename for it, the file it left in Recent" (on the base: expected 3, found 4); core-test 1063/1233 (170 skipped), behaviour-test 280/280, pane-test 183/184 (1 skipped); the corpus's frames under walk: in the final gate's report
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core')
| -rw-r--r-- | core/Trail.zig | 19 | ||||
| -rw-r--r-- | core/panes.zig | 4 |
2 files changed, 20 insertions, 3 deletions
diff --git a/core/Trail.zig b/core/Trail.zig index 9223d1d3..5f6302e4 100644 --- a/core/Trail.zig +++ b/core/Trail.zig @@ -192,8 +192,11 @@ pub fn replaceStep(p: *Pardes, id: usize, path: []const u8, at: Spot) !usize { } /// Pane `id` showing `path` at `at`, the keyboard on it: its caret moved -/// in the file it shows, or a new pane on `path` in its place, its walk -/// with it. A line past the new file's end is a miss that changes nothing. +/// in the file it shows, or `path` opened in its place as the same pane, as +/// acme's Get keeps a window's id: its walk, its serial (`@pN`, a script's +/// `/pane/N`), the 9P state its scripts hold and its /log record (a rename), +/// the file it left closed as any (Recent keeps its place). A line past the +/// new file's end is a miss that changes nothing. fn show(p: *Pardes, id: usize, path: []const u8, at: Spot) !usize { const pane = p.panes[id].?; if (pane.file) |f| if (std.mem.eql(u8, f.path, path)) { @@ -211,11 +214,23 @@ fn show(p: *Pardes, id: usize, path: []const u8, at: Spot) !usize { } if (at.line > panes.File.nlines(p.gpa, &nt.file.?)) return error.LineMissing; nt.trail = pane.trail; + // What jj answered for the file it leaves goes with that file; its + // text a revision on from the one it leaves, so nothing a worker was + // asked of that text (a parse, a paint, both by serial and revision) + // lands on this one. + @import("jj.zig").forget(p, pane.serial); + nt.serial = pane.serial; + nt.file.?.revision = if (pane.file) |f| f.revision +% 1 else 0; + nt.file.?.saved_revision = nt.file.?.revision; + // Its 9P state: the one never announced leaves with no record. + std.mem.swap(@TypeOf(pane.fs), &nt.fs, &pane.fs); // Before the layout gives its place away: its file is told closed // while it is still in its slot. try panes.deinitPane(p, pane); layout.replacePane(p, id, free); p.panes[id] = null; + pardes.ctlfs.events.noteLog(p, .rename, nt); + if (pardes.Pardes.onDisk(nt)) p.recent.opened(p.recentGpa(), path); lift(p, free); look.focusPaneLine(p, free, at, .keep); // Its line half the body's rows down, as a look's new pane has it. diff --git a/core/panes.zig b/core/panes.zig index e4ed3e9d..20a03b25 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -1254,7 +1254,9 @@ pub fn teardownPane(p: *Pardes, pane: *Pane) void { pane.jump.deinit(p.gpa); pane.places.deinit(p.gpa); p.gpa.free(pane.recipe_sels); - @import("jj.zig").forget(p, pane.serial); + // A pane that walked on (Trail.show) is the same pane on another file: + // what jj answers now is its own. + if (p.paneBySerial(pane.serial) == null) @import("jj.zig").forget(p, pane.serial); if (pane.query) |q| { q.deinit(p.gpa); p.gpa.destroy(q); |
