summaryrefslogtreecommitdiff
path: root/core/edit_cmd.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 15:05:16 -0300
committerGabriel Schneider <[email protected]>2026-11-25 15:08:19 -0300
commit4e5f978f90db55092420a5f5f8f06fff0a5f3d07 (patch)
treec857eea0e1dbaadecd68905ce8e7d824ab44639c /core/edit_cmd.zig
parente77e2b16927f1cd55fa2edde44bb591c6197b2c5 (diff)
parent2e98333b8d4ae7302eb53d7f6b0c667f371adcc5 (diff)
downloadpardes-4e5f978f90db55092420a5f5f8f06fff0a5f3d07.tar.gz
pardes-4e5f978f90db55092420a5f5f8f06fff0a5f3d07.zip
walk UI M12: D1's four changes (xtvnwlpo an Edit's change holds the reading pane it changes, Trail.edited after its File.load; tqswwxlu test/daemon.py's plain row under the walk default; vlkqvktp a newer build installed is said of no pane; owxmwxxn 2e98333b8d4a the no-build-could-load outcome an error of no pane, and the upgrade row reading what the walk UI draws) merged onto M11 and the Band fix (ovooknov), resolved by meaning: no text conflict and no file in common (D1: core/edit_cmd.zig, runtime/upgrade.zig, test/daemon.py; the rest of the line touches none of them), and none reads what another stack changed: D1's rows read the notice row as F2 left it only through the session's /log and the row's lead mark, which F2's give-way keeps (a row that fits is built byte for byte as before; a cut one keeps its mark and its words before its cause's path); core-test 1108/1279 (171 skipped: 1106 + D1's two), load 1.6 to 4
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/edit_cmd.zig')
-rw-r--r--core/edit_cmd.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/edit_cmd.zig b/core/edit_cmd.zig
index 8fbde726..7efa98bc 100644
--- a/core/edit_cmd.zig
+++ b/core/edit_cmd.zig
@@ -417,6 +417,10 @@ fn commit(p: *Pardes, pd: *Pending, outputs: []const []const u8) void {
return p.reportError(.at(at), "Edit", err);
};
panes.File.load(p, pf, new);
+ // An edit, though made as a new text: a reading pane it
+ // changes is held (pick-ui SPEC ยง6.5), or a jump from it
+ // would step it off its unsaved text.
+ pardes.Trail.edited(p, pf);
}
}
if (ops.len > 0 or f.moved) ninep_pane.setFileDot(p.settings.tab, pane, sam.moveDot(f.dot, ops));
@@ -803,3 +807,29 @@ test "e and r say a file that cannot be read as Get says it" {
try testing.expect(std.mem.indexOf(u8, r.reply.ename, c[1]) != null);
}
}
+
+test "an Edit's change holds the reading pane it changes, as a typed one does: a Look from it after opens its reader, and the change stays in it" {
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(testing.io, .{ .sub_path = "notes.txt", .data = "one\ntwo\nthree\n" });
+ try tmp.dir.writeFile(testing.io, .{ .sub_path = "big.txt", .data = "big\n" });
+ var dir_buf: [4096]u8 = undefined;
+ const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)];
+ const p = try th.withFile(testing.allocator, "scratch\n");
+ defer p.deinit();
+ p.settings.jumps = .walk;
+ var path: [4200]u8 = undefined;
+ // The notes in a reading pane (the first walked to them).
+ look.lookAt(p, 0, try std.fmt.bufPrint(&path, "{s}/notes.txt", .{dir}));
+ const notes = p.view().active;
+ try testing.expect(pardes.Trail.reading(p, p.panes[notes].?));
+ try testing.expectEqual(tree.Status.ok, th.wr(p, tree.Node.of(p.panes[notes].?.serial, .ctl), "Edit 3a/ an edit/\n").reply.status);
+ try testing.expectEqualStrings("one\ntwo\nthree\n an edit", p.panes[notes].?.file.?.content);
+ try testing.expect(!pardes.Trail.reading(p, p.panes[notes].?));
+ // A Look from it: its reader, under it; the notes and their change kept.
+ look.lookAt(p, notes, try std.fmt.bufPrint(&path, "{s}/big.txt", .{dir}));
+ const reader = p.view().active;
+ try testing.expect(reader != notes);
+ try testing.expectEqualStrings("big.txt", std.Io.Dir.path.basename(p.panes[reader].?.file.?.path));
+ try testing.expectEqualStrings("one\ntwo\nthree\n an edit", p.panes[notes].?.file.?.content);
+}