summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 04:56:17 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commite2452380ed42d3b418930e375780745612d599c5 (patch)
tree61ca969e4ba5df779953e7b9c06b03d09cc1af43 /src/ninep/tree.zig
parent253a5c1e036d96eada910c47eb500ed0c8e37b5c (diff)
downloadpardes-e2452380ed42d3b418930e375780745612d599c5.tar.gz
pardes-e2452380ed42d3b418930e375780745612d599c5.zip
An a, c or i text with no . line fails the Edit, as an open { does
sam takes the end of input as a text block's end, so a block cut short (a write that lost its tail, an open closed early) inserted half of itself. An Edit whose a, c or i text never meets its . line now fails with "a, c or i text not ended by a . line" and changes nothing, as an unclosed { does; at a close, logged as an err. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/tree.zig')
-rw-r--r--src/ninep/tree.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index 398824d5..54d21da6 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -1536,3 +1536,14 @@ test "an Edit block still open when its open closes fails there with an err and
try testing.expect(th.logHas(p, "unmatched"));
try testing.expectEqualStrings("abc\n", p.panes[0].?.file.?.content);
}
+
+test "an a, c or i text still open when its open closes fails there too and changes nothing" {
+ const p = try th.withFile(testing.allocator, "abc\n");
+ defer p.deinit();
+ const ctl_node = Node.of(serialOf(p), .ctl);
+ const c = call(p, .{ .tag = 1, .op = .open, .node = ctl_node, .omode = 1 }).reply.handle;
+ _ = call(p, .{ .tag = 2, .op = .write, .node = ctl_node, .handle = c, .data = "Edit $a\nhalf of a block\n" });
+ _ = call(p, .{ .tag = 3, .op = .release, .node = ctl_node, .handle = c, .opened = true });
+ try testing.expect(th.logHas(p, "not ended by a . line"));
+ try testing.expectEqualStrings("abc\n", p.panes[0].?.file.?.content);
+}