From 3815a0bfad5818e2caf85a00c0c2d3aecc13bd1c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 23:58:54 -0300 Subject: pardes - reads stdin into a +Pager pane, and is a terminal's PAGER and GIT_PAGER, Pager pardes|off to opt out; command panes page through cat A paging command in a terminal, or run through its pty/run, sat in less, and a pty/run never answered. `pardes -` now reads stdin to its end, strips terminal escapes (colour, OSC, overstrike), and shows it: inside a session as a clean /+Pager pane made through pane/new and back at once, outside one as a new editor whose first pane it is, as `vim -` does. A terminal's shell gets PAGER and GIT_PAGER set to this pardes's own path and `-` where the user's environment sets neither; `Pager off`, a setting in /ctl, init and DumpConfig, leaves terminals started after it to the environment. A command pane's one-shot shell keeps cat, its output being a pane already. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ninep/ctl.zig') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index e0c4b21b..87339b70 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1812,6 +1812,17 @@ test "a look at a file it may not read fails the write naming the file" { try testing.expectEqualStrings(expected, refused.reply.ename); } +test "Pager is a setting of the root ctl: pardes by default, off taken, anything else refused with its choices" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + const root_ctl = @intFromEnum(tree.TopFile.ctl); + try testing.expect(std.mem.indexOf(u8, rd(p, root_ctl, 0, 1 << 16).bytes, "Pager pardes\n") != null); + try testing.expectEqual(Status.ok, wr(p, root_ctl, "Pager off\n").reply.status); + try testing.expectEqual(config.Runtime.Pager.off, p.settings.pager); + try testing.expect(std.mem.indexOf(u8, rd(p, root_ctl, 0, 1 << 16).bytes, "Pager off\n") != null); + try testing.expectEqualStrings("bad value in control message; takes pardes, off \"Pager\"", wr(p, root_ctl, "Pager less\n").reply.ename); +} + 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