diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 13:55:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 7da8fe5005f0fd44899a1172e763fddcd7cac4d2 (patch) | |
| tree | 32ebf8e16eaef888bdc560213673444a338fab78 | |
| parent | 72937852d08a6a49f3c0cb2e903b533530b88ae1 (diff) | |
| download | pardes-7da8fe5005f0fd44899a1172e763fddcd7cac4d2.tar.gz pardes-7da8fe5005f0fd44899a1172e763fddcd7cac4d2.zip | |
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 <[email protected]>
| -rw-r--r-- | docs/fs.md | 4 | ||||
| -rw-r--r-- | src/ninep/addr.zig | 12 |
2 files changed, 15 insertions, 1 deletions
@@ -313,7 +313,9 @@ the whole text instead, its `.` kept to one line. An expression is evaluated from the current address, the range last written to `addr` (or left by the last `data` write, just past it), as acme evaluates it from `w->addr` (xfid.c:446): `.` is that address, not the selection (`dot` is -the selection's own file), and `#9/re/` searches from `#9`. `/re/` searches +the selection's own file), and `#9/re/` searches from `#9`; in `/a/;/b/` +the second search starts at the end of the first, as acme's `;` does, where +`/a/,/b/` starts both at the current address. `/re/` searches forward from the end of the current range to `limit` if one is set, and otherwise wraps to the start of the text; `?re?` and `-/re/` find the last match ending before the range, wrapping to the text's last. The match is the leftmost, but of 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" { |
