summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 08:11:52 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit675191642edfd5a4492cfb966e65d973f4ffcf0d (patch)
treeeceb6b67ce30be678c19e15c89840f351b94d3bf
parent6c10e2b37ee7b95485fb86941de32991a1732892 (diff)
downloadpardes-675191642edfd5a4492cfb966e65d973f4ffcf0d.tar.gz
pardes-675191642edfd5a4492cfb966e65d973f4ffcf0d.zip
A column ctl write reads back what it touched alone
writeCtl never cleared what the last write touched before its lines ran, so `New` through col/<n>/ctl read back the earlier write's serial too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--src/ninep/cols.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig
index b00ecdba..efb62cfe 100644
--- a/src/ninep/cols.zig
+++ b/src/ninep/cols.zig
@@ -126,6 +126,8 @@ pub fn released(p: *Pardes, serial: ?u32) void {
/// Delcol, Joincol, New, Tty -- one a line, each run as from that tag. What
/// they say is the session's in the log (`msg -`), not the focused pane's.
pub fn writeCtl(p: *Pardes, req: Req, serial: u32) Reply {
+ // What this write touched, alone, reads back (runBuiltin notes it).
+ p.fs.results_len = 0;
p.fs.session_write = true;
defer p.fs.session_write = false;
var lines = std.mem.splitScalar(u8, req.data, '\n');
@@ -189,6 +191,17 @@ test "New written to a column's exec makes its scratch in the session's director
try testing.expectEqualStrings("/project/src/+New", p.panes[p.active].?.file.?.path);
}
+test "New written to a column's ctl reads back the new pane alone, as its exec does" {
+ const p = try th.withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ const root_exec = @intFromEnum(tree.TopFile.exec);
+ _ = th.wr(p, root_exec, "Msg before\n");
+ const ctl_node = tree.Node.ofCol(layout.columnSerial(p, 0), .ctl);
+ try testing.expectEqual(tree.Status.ok, th.wr(p, ctl_node, "New\n").reply.status);
+ var want: [16]u8 = undefined;
+ try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{p.panes[p.active].?.serial}), th.rd(p, root_exec, 0, 64).bytes);
+}
+
/// rmdir of a column closes it when it is empty; one with panes is
/// refused, saying so (close them, or Delcol on its ctl, which asks first).
pub fn remove(p: *Pardes, req: Req, serial: u32, file: tree.ColFile) Reply {