summaryrefslogtreecommitdiff
path: root/src/ninep/sources.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/sources.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/sources.zig')
-rw-r--r--src/ninep/sources.zig6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/ninep/sources.zig b/src/ninep/sources.zig
index b0408594..846ab758 100644
--- a/src/ninep/sources.zig
+++ b/src/ninep/sources.zig
@@ -102,11 +102,7 @@ pub fn handle(p: *Pardes, req: Req) Reply {
},
.read => {
if (found.dir) return Reply.fail(req.tag, E.PERM);
- const off: usize = @intCast(@min(req.off, found.contents.len));
- const bytes = found.contents[off..][0..@min(req.size, found.contents.len - off)];
- const out = p.fs.stage(p.gpa);
- out.appendSlice(p.gpa, bytes) catch return Reply.fail(req.tag, E.NOMEM);
- return .{ .tag = req.tag, .payload = .{ .staged = @intCast(bytes.len) } };
+ return tree.window(p, req, found.contents);
},
else => return Reply.fail(req.tag, E.PERM),
}