From 7da8fe5005f0fd44899a1172e763fddcd7cac4d2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 13:55:25 -0300 Subject: Addresses: acme's ; is tested and documented /a/;/b/ searches b from the end of a (acme's addr.c:170-171 sets ar to the left side), and /a/,/b/ searches both from the current address; the review asked that it be confirmed, and it held. Co-Authored-By: Claude Opus 5.5 --- src/ninep/addr.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/ninep/addr.zig b/src/ninep/addr.zig index 3b29f622..0537c17a 100644 --- a/src/ninep/addr.zig +++ b/src/ninep/addr.zig @@ -272,6 +272,18 @@ test "an address is evaluated from the current one, as acme's are" { } // A range whose end comes before its start is sam's error. try testing.expectEqualStrings(e_order, th.wr(p, addr, "#10,#5").reply.ename); + + // `;` evaluates its right side from its left (acme's addr.c:170-171, + // `ar = r`), `,` from the address the whole started at. + const q = try th.withFile(testing.allocator, "b a b\n"); + defer q.deinit(); + const qaddr = Node.of(th.serialOf(q), .addr); + _ = th.wr(q, qaddr, "#0"); + try testing.expectEqual(Status.ok, th.wr(q, qaddr, "/a/;/b/").reply.status); + try testing.expectEqual(@as(u32, 2), q.panes[0].?.fs.addr.q0); + try testing.expectEqual(@as(u32, 5), q.panes[0].?.fs.addr.q1); + _ = th.wr(q, qaddr, "#0"); + try testing.expectEqualStrings(e_order, th.wr(q, qaddr, "/a/,/b/").reply.ename); } test "regular expressions search lines as sam's do, and a search wraps" { -- cgit v1.3