diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 23:58:54 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:18 -0300 |
| commit | 3815a0bfad5818e2caf85a00c0c2d3aecc13bd1c (patch) | |
| tree | dfb1920c13ac0e113d9294c96f86d36ecf95bbc9 /src/ninep/ctl.zig | |
| parent | 03ace1893d1a4b509c209e4e8ca023f7261e5cb9 (diff) | |
| download | pardes-3815a0bfad5818e2caf85a00c0c2d3aecc13bd1c.tar.gz pardes-3815a0bfad5818e2caf85a00c0c2d3aecc13bd1c.zip | |
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 <cwd>/+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 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 11 |
1 files changed, 11 insertions, 0 deletions
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"); |
