diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 13:14:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 41fb292f314844d1f47e608fbdd4a34cfc8d5618 (patch) | |
| tree | 5f0b6f9bd6feddb88881623a6d990bcab454021e /src/ninep/pane.zig | |
| parent | 84fca2d6e5f498f2d4384712d49d727a25441d68 (diff) | |
| download | pardes-41fb292f314844d1f47e608fbdd4a34cfc8d5618.tar.gz pardes-41fb292f314844d1f47e608fbdd4a34cfc8d5618.zip | |
An address searches back after a minus, and a range ending before its start is refused
-/re/ searched forward, since only ?re? set the direction, where acme's
address() takes the direction a minus set (addr.c). And #100,#50 was taken,
leaving data to act on an empty range at 100; sam refuses it as 'addresses out
of order', which acme leaves out, and so does pardes now. The rest of the
dogfood report on addresses already held and is now tested: an expression is
evaluated from the current address, as acme evaluates it from w->addr
(xfid.c:446), so a search starts where the last address or data write left
it and . is that address. Taking . as the selection instead, as the report
asked, would part from acme, which has dot only in its ctl messages; the docs
say which is which.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 0a511118..6b6d5728 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -453,16 +453,22 @@ pub const e_addr_failed = "no address: the last one written to addr failed"; /// A range file takes an address expression, or that pair of offsets. One /// that does not evaluate says why: `bad address syntax`, `no match for -/// regexp`, `address out of range`, `bad regular expression`. +/// regexp`, `address out of range`, `bad regular expression`, `addresses +/// out of order`. fn writeRange(req: Req, pane: *Pane, file: PaneFile) Reply { const pf = &pane.fs; const text = bodyOf(pane); clampAddr(pf, text.len); const expr = std.mem.trimEnd(u8, req.data, "\n"); var a: addressing.Addr = .{ .text = text, .lim = pf.limit, .expr = expr }; - const r = if (pairOf(expr)) |pair| + var r = if (pairOf(expr)) |pair| State.Range{ .q0 = @min(pair.q0, clip(text.len)), .q1 = @min(pair.q1, clip(text.len)) } else if (a.address(pf.addr)) |found| (if (a.i < expr.len) null else found) else null; + // sam's check, which acme leaves out: `#100,#50` names no range. + if (r) |found| if (found.q0 > found.q1) { + a.err = addressing.e_order; + r = null; + }; const range = r orelse { if (file == .addr) pf.addr_failed = true; return tree.failText(req.tag, E.INVAL, a.err); |
