From 28e90e064bd317d0e253edb2f5b305a6192f560b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 01:00:42 -0300 Subject: A bare :N or :N:M look addresses the pane itself, its line N (column M), from every way a look comes; a PDF's :0 has no page 0 A look of `:12` had no path to resolve, so it fell through to a word search for the text ":12" and found nothing. A digit-led address with no path now names the looking pane, as `:/re/` already did: its look, the root's (the keyboard's pane), Look, B3 and an event write-back all reach it, a terminal's logical lines included. On a PDF, :0 is the has-no-page miss rather than a refusal. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/ninep') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index cdb6092a..fd3418a1 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1823,6 +1823,25 @@ test "Pager is a setting of the root ctl: pardes by default, off taken, anything try testing.expectEqualStrings("bad value in control message; takes pardes, off \"Pager\"", wr(p, root_ctl, "Pager less\n").reply.ename); } +test "a bare :N or :N:M look addresses the pane itself, from its look, the root's and event write-back" { + const p = try withFile(testing.allocator, "alpha\nbeta\ngamma\n"); + defer p.deinit(); + const serial = serialOf(p); + const pane = p.panes[p.paneBySerial(serial).?].?; + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .look), ":2\n").reply.status); + try testing.expectEqual(pane_files.State.Range{ .q0 = 6, .q1 = 11 }, pane_files.dotOf(pane)); + try testing.expectEqual(Status.ok, wr(p, root_look, ":3\n").reply.status); + try testing.expectEqual(pane_files.State.Range{ .q0 = 11, .q1 = 17 }, pane_files.dotOf(pane)); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .look), ":3:2\n").reply.status); + try testing.expectEqual(@as(u32, 12), pane_files.dotOf(pane).q0); + // Written back by an event reader, the same. + const event = Node.of(serial, .event); + const h = call(p, .{ .tag = 1, .op = .open, .node = event }).reply.handle; + defer _ = call(p, .{ .tag = 9, .op = .release, .node = event, .handle = h }); + try testing.expectEqual(Status.ok, wr(p, event, "ML0 0 0 2 :1\n").reply.status); + try testing.expectEqual(pane_files.State.Range{ .q0 = 0, .q1 = 6 }, pane_files.dotOf(pane)); +} + test "a refused Del written back through event fails that write, EIO, with its err" { const gpa = testing.allocator; const p = try withFile(gpa, "text\n"); -- cgit v1.3