diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 07:12:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | d13ae04008e678ed992e6181487dbfd126a4154f (patch) | |
| tree | 54c2460c28eed783683206cc1685fa958a786589 | |
| parent | 9ecabb15b648237cca94253a7abc4b556805fde0 (diff) | |
| download | pardes-d13ae04008e678ed992e6181487dbfd126a4154f.tar.gz pardes-d13ae04008e678ed992e6181487dbfd126a4154f.zip | |
A look line takes `?re?` after its colon, as addr does
`file:?foo?`, `@p5:?foo?` and `:?foo?` were not taken for addresses (the
first character had to be one of `0-9+-/$.#,;`), so they went the path
way and found nothing.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
| -rw-r--r-- | docs/fs.md | 4 | ||||
| -rw-r--r-- | src/look.zig | 2 | ||||
| -rw-r--r-- | src/ninep/ctl.zig | 3 |
3 files changed, 6 insertions, 3 deletions
@@ -466,12 +466,12 @@ unfinished was cut short. A fragment never runs on its own. A line or Edit block held past 1 MiB is refused (EINVAL). `@p<serial>:<address>` addresses the pane with that serial as `file:<address>` -does a file, with any sam address (`/re/`, `#n`, `$`, `0/re/`, a range), +does a file, with any sam address (`/re/`, `?re?`, `#n`, `$`, `0/re/`, a range), a terminal too: its body is then the text of its logical lines (the lines a `+Search` of it lists), addressed from its cursor, and the match is selected. A miss, and a serial no pane has (with a line, `@p77:3`, as with any other address), each log an `err`, and look reads back empty. A look takes acme's addresses after a colon (editors/acme/look.c:450): a -line written to `look` as `file:/re/`, `file:#n`, `file:$` or any address +line written to `look` as `file:/re/`, `file:?re?`, `file:#n`, `file:$` or any address opens (or finds) the file and selects what the address names. **The address is evaluated from the file's dot**, as acme's is: `file:/re/` finds the next match after the current selection, not the first in the diff --git a/src/look.zig b/src/look.zig index cfebd42d..92e711fa 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1266,7 +1266,7 @@ fn addressed(tok: []const u8) ?struct { path: []const u8, expr: []const u8 } { // pattern in the address may (`calc.py:/return a/`). if (std.mem.indexOfAny(u8, tok[0..colon], " \t") != null) return null; if (std.mem.indexOfAny(u8, expr, " \t") != null and std.mem.indexOfAny(u8, expr, "/?") == null) return null; - if (expr.len == 0 or std.mem.indexOfScalar(u8, "0123456789+-/$.#,;", expr[0]) == null) return null; + if (expr.len == 0 or std.mem.indexOfScalar(u8, "0123456789+-/?$.#,;", expr[0]) == null) return null; if (std.ascii.isDigit(expr[0])) { const pl = parsePathLine(tok); if (pl.at.line != 0 and pl.end == tok.len) return null; diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index acb1b934..02201de0 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1951,6 +1951,9 @@ test "@p<serial>:<address> takes any sam address; a miss and an unknown serial a .{ .addr = "#12,#15", .want = " 12 15 " }, .{ .addr = "$", .want = " 16 16 " }, .{ .addr = "1,2", .want = " 0 16 " }, + // Backward, as in addr: from the dot's start, wrapping to the last. + .{ .addr = "?foo?", .want = " 6 9 " }, + .{ .addr = "$-?y?", .want = " 10 11 " }, }) |c| { var line: [64]u8 = undefined; try testing.expectEqual(Status.ok, wr(p, root, try std.fmt.bufPrint(&line, "@p{d}:{s}\n", .{ serial, c.addr })).reply.status); |
