summaryrefslogtreecommitdiff
path: root/core/Trail.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Trail.zig')
-rw-r--r--core/Trail.zig19
1 files changed, 17 insertions, 2 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.