summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 12:24:12 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit276a060dee5c753b513a75cca0b2c942dfe540fd (patch)
tree16c558a5d4bcaaef587ec9060c1ba212c662678d /src/ninep/pane.zig
parentd191193a1e707a6bfd8fc8bbe1429dbc9f34676f (diff)
downloadpardes-276a060dee5c753b513a75cca0b2c942dfe540fd.tar.gz
pardes-276a060dee5c753b513a75cca0b2c942dfe540fd.zip
A name cut across writes on one open is one name, applied once
Each write to name was taken as a whole name, so a name a client wrote in two pieces renamed the pane twice, the first time to half a name. name's writes are now held per open, as exec's and ctl's lines are, until the newline or the close. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index fe3312b4..9cb1dba6 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -1057,6 +1057,23 @@ test "the writes of one open are one undo step, as bash's line-buffered printf m
}
}
+test "a name cut across writes is one name, applied once at its newline or its close" {
+ const p = try withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ const serial = serialOf(p);
+ const node = Node.of(serial, .name);
+ const h = call(p, .{ .tag = 1, .op = .open, .node = node, .omode = 1 }).reply.handle;
+ try testing.expect(h != 0);
+ _ = call(p, .{ .tag = 2, .op = .write, .node = node, .handle = h, .data = "/tmp/pardes-na" });
+ try testing.expectEqualStrings("/test.txt", nameOf(p.panes[p.paneBySerial(serial).?].?));
+ _ = call(p, .{ .tag = 2, .op = .write, .node = node, .handle = h, .data = "me.txt\n" });
+ try testing.expectEqualStrings("/tmp/pardes-name.txt", nameOf(p.panes[p.paneBySerial(serial).?].?));
+ // No newline: the close applies it.
+ _ = call(p, .{ .tag = 2, .op = .write, .node = node, .handle = h, .data = "/tmp/pardes-closed.txt" });
+ _ = call(p, .{ .tag = 3, .op = .release, .node = node, .handle = h, .opened = true });
+ try testing.expectEqualStrings("/tmp/pardes-closed.txt", nameOf(p.panes[p.paneBySerial(serial).?].?));
+}
+
test "a replace through data, truncate then write, is one undo step" {
const p = try withFile(testing.allocator, "one two\n");
defer p.deinit();