From 66c4095e140694376fd07c3afa0fee721558bdb3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:38:29 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/ninep/sources.zig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/ninep/sources.zig') 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), } -- cgit v1.3