summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/fs.md4
-rw-r--r--src/ninep/addr.zig12
2 files changed, 15 insertions, 1 deletions
diff --git a/docs/fs.md b/docs/fs.md
index d0c371c7..f98a1ae0 100644
--- a/docs/fs.md
+++ b/docs/fs.md
@@ -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" {