summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:38:29 -0300
committerGabriel Schneider <[email protected]>2026-11-05 00:58:28 -0300
commit66c4095e140694376fd07c3afa0fee721558bdb3 (patch)
treee7ce443023bd305cb5707be56731985ad55a11c3 /src/ninep/pane.zig
parent4592c18aa80d61a87026ca5823232ce56837f1f7 (diff)
downloadpardes-66c4095e140694376fd07c3afa0fee721558bdb3.tar.gz
pardes-66c4095e140694376fd07c3afa0fee721558bdb3.zip
ninep: one tree.window answers a read with the part of a text its offset and size ask for, where ten places (a frozen listing, a stream's replay, README, /screen, the sources, a PDF's or a terminal's body, a tag, a column's) windowed by hand; /status, the root ctl, /commands and /listeners are each one text in the step's scratch, read and counted from it, so the xLen and readX pairs (statusLen, rootLen, commandsLen, readStatus, readRoot, readCommands, readPane, readListeners) go; tree.read asks openOf once
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index c12b2e80..48095c46 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -413,11 +413,12 @@ pub fn read(p: *Pardes, req: Req, id: usize, pane: *Pane, file: PaneFile) Reply
.body => readBody(p, req, id, pane),
.tag => tag: {
applyTagTruncation(p, pane);
- const out = p.fs.stage(p.gpa);
- out.appendSlice(p.gpa, tagOf(p, pane)) catch {};
- break :tag tree.stagedReply(p, req);
+ break :tag tree.window(p, req, tagOf(p, pane));
+ },
+ .ctl => ctl: {
+ var buf: [ctl.pane_text_cap]u8 = undefined;
+ break :ctl tree.window(p, req, ctl.paneText(p, pane, &buf));
},
- .ctl => ctl.readPane(p, req, pane),
// A failed address reads empty, as an unset limit does: there is
// none. data and xdata are what refuse.
.addr => readRange(p, req, if (pf.addr_failed) null else addr: {
@@ -477,17 +478,12 @@ fn readBody(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
} } };
}
// A PDF's body is its text layer, the page shown's: read-only.
- if (pdfText(p, pane)) |text| {
- p.fs.stage(p.gpa).appendSlice(p.gpa, text) catch return Reply.fail(req.tag, E.NOMEM);
- return tree.stagedReply(p, req);
- }
+ if (pdfText(p, pane)) |text| return tree.window(p, req, text);
if (req.handle != 0 and pane.isTerminal()) return screen.readSnapshot(p, req, pane);
const text = panes.terminal.screenTextAlloc(pane, p.gpa) catch
return Reply.fail(req.tag, E.NOMEM);
defer p.gpa.free(text);
- const out = p.fs.stage(p.gpa);
- out.appendSlice(p.gpa, text) catch return Reply.fail(req.tag, E.NOMEM);
- return tree.stagedReply(p, req);
+ return tree.window(p, req, text);
}
fn readData(req: Req, id: usize, pane: *Pane, pf: *State, stop_at_end: bool) Reply {