summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 01:14:37 -0300
committerGabriel Schneider <[email protected]>2026-10-01 01:35:12 -0300
commit77bda7e14e0ea81db5da54c233fc30d218773f47 (patch)
tree403fd24114e80d98318cf8b7cb827eda1b89c53c /src/ninep/ctl.zig
parente6ff64843b4a8986e9740c576f346690217cf5a7 (diff)
downloadpardes-77bda7e14e0ea81db5da54c233fc30d218773f47.tar.gz
pardes-77bda7e14e0ea81db5da54c233fc30d218773f47.zip
pardes - keeps one +Pager per directory, refilled, named so from its first log record; streams the text in bounded writes; never loses it; handles \r, NUL and BEL as a terminal does
Each paged command made another +Pager until placement failed, and then git's text was lost with exit 0; a 130 MB page timed out half written and dirty; a directory whose name held a newline left a stray +New; and the log said new +New then rename. The root ctl's `pager <dir>` now makes the directory's +Pager (named before it is announced, placed without the keyboard) or empties the one there; the text goes into it a line-ended 8 MiB chunk a write, one undo step, up to the file limit and its note, and is left clean. A directory a ctl line cannot name pages into the session's. Any failure prints the text to stderr with why and exits 1. A carriage return keeps a progress line's last state and CRLF is a newline; NUL, BEL, SO and SI go; empty stdin makes no pane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index fd3418a1..82001f32 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -642,6 +642,18 @@ pub fn writeRoot(p: *Pardes, req: Req) Reply {
var it = Messages.init(p, req.data);
while (it.next()) |line| {
if (line.len == 0 or exec_line.isComment(line)) continue;
+ // `pardes -`'s: the directory's +Pager made or emptied, its
+ // serial what /exec reads back.
+ if (std.mem.startsWith(u8, line, "pager ") or std.mem.eql(u8, line, "pager")) {
+ if (!apply) continue;
+ const id = pardes.panes.Output.openPager(p, p.active, std.mem.trim(u8, line["pager".len..], " \t")) catch |err|
+ return tree.failText(req.tag, if (err == error.NoPaneRoom or err == error.NoPaneSlots) E.NOSPC else E.IO, switch (err) {
+ error.NoPaneRoom, error.NoPaneSlots => "pager: no space for a +Pager pane",
+ else => "pager: could not make a +Pager pane",
+ });
+ noteResult(p, p.panes[id].?.serial);
+ continue;
+ }
if (std.mem.startsWith(u8, line, "size ") or std.mem.eql(u8, line, "size")) {
const size = sizeOf(line) orelse return refuse(p, req, e_size, line);
// A frontend's window is the size; only a session none is