summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 11:58:58 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit946e7c6c00c1ecc20c1e529608423ac9caa6c6ba (patch)
treec559d388178cd31e7501dc8ffbe041c980f57851 /src
parent8c86eb1bccf5846d5f5b627845f640e3b6b12134 (diff)
downloadpardes-946e7c6c00c1ecc20c1e529608423ac9caa6c6ba.tar.gz
pardes-946e7c6c00c1ecc20c1e529608423ac9caa6c6ba.zip
A column's and the workspace's tag read with no trailing newline, as a pane's does
A pane tag read back its text alone, but a column tag and /tag appended a newline and gave a stat size one byte longer. So `$(cat tag)` agreed across the three kinds while `cat tag | wc -c` and a byte compare did not. All three now read the text alone, and fs.md says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ninep/cols.zig8
-rw-r--r--src/ninep/tree.zig4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig
index 4db78584..1919122d 100644
--- a/src/ninep/cols.zig
+++ b/src/ninep/cols.zig
@@ -69,8 +69,8 @@ pub fn read(p: *Pardes, req: Req, serial: ?u32) Reply {
applyTruncation(p, serial);
const text = headerText(p, serial) orelse return Reply.fail(req.tag, E.NOENT);
const out = p.fs.stage(p.gpa);
+ // As a pane tag reads: the text alone, no newline after it.
out.appendSlice(p.gpa, text) catch return Reply.fail(req.tag, E.NOMEM);
- out.append(p.gpa, '\n') catch return Reply.fail(req.tag, E.NOMEM);
return tree.stagedReply(p, req);
}
@@ -390,15 +390,15 @@ test "a column's tag and the workspace's read, replace and append as a pane tag
try testing.expectEqual(E.NOENT, th.look_up(p, col_dir, "777").errno());
const tag = Node.ofCol(serial, .tag);
try testing.expectEqual(tree.Status.ok, th.look_up(p, Node.ofCol(serial, .dir), "tag").reply.status);
- try testing.expectEqualStrings("New Tty Find Grep Joincol Delcol\n", th.rd(p, tag, 0, 4096).bytes);
+ try testing.expectEqualStrings("New Tty Find Grep Joincol Delcol", th.rd(p, tag, 0, 4096).bytes);
// `echo Make > tag`: cleared, then the newline ending the write dropped.
_ = th.call(p, .{ .tag = 1, .op = .setattr, .node = tag, .truncate = true });
_ = th.wr(p, tag, "Make\n");
- try testing.expectEqualStrings("Make\n", th.rd(p, tag, 0, 4096).bytes);
+ try testing.expectEqualStrings("Make", th.rd(p, tag, 0, 4096).bytes);
_ = th.call(p, .{ .tag = 2, .op = .release, .node = tag });
// `>>` appends; a newline in a one-line tag is a space.
_ = th.wr(p, tag, " Lint\nNow");
- try testing.expectEqualStrings("Make Lint Now\n", th.rd(p, tag, 0, 4096).bytes);
+ try testing.expectEqualStrings("Make Lint Now", th.rd(p, tag, 0, 4096).bytes);
const top = @intFromEnum(tree.TopFile.tag);
_ = th.call(p, .{ .tag = 3, .op = .setattr, .node = top, .truncate = true });
_ = th.wr(p, top, "Newcol Exit\n");
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index 10208666..17941e10 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -605,7 +605,7 @@ fn attrOf(p: *Pardes, target: Target) ?Reply.Attr {
.tag, .exec => 0o666,
},
.size = switch (c.file) {
- .tag => cols.headerText(p, c.serial).?.len + 1,
+ .tag => cols.headerText(p, c.serial).?.len,
.exec => ctl.resultsLen(p),
else => 0,
},
@@ -647,7 +647,7 @@ fn topSize(p: *Pardes, f: TopFile) u64 {
// and /pane/new none until an open has a pane to name.
.root, .pane, .col, .screen, .new => 0,
.layout => cols.layoutLen(p),
- .tag => cols.headerText(p, null).?.len + 1,
+ .tag => cols.headerText(p, null).?.len,
.index => pane.indexLen(p),
.README => fs.help.len,
.status => ctl.statusLen(p),