From 137dc2ea4be0fc5baf4cab1d8a757ce426e5cbb2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 30 Sep 2026 21:19:57 -0300 Subject: Views generated by each read stat 0, as acme's do: data, xdata, index, layout, recent and listeners; fs.md says which files have real lengths A stat of index, layout, recent or listeners built the whole view to count it, and data and xdata reported the body's length though a read answers what addr selects. Those now stat 0, as screen and pane/new already did, and fs.md lists the files whose length is real and says to read the rest to the end. Co-Authored-By: Claude Opus 5.5 --- src/ninep/tree.zig | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/ninep/tree.zig') diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index c0ace5be..a7f3f2a4 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -253,13 +253,6 @@ pub const TopFile = enum(u5) { pub const root: u64 = @intFromEnum(TopFile.root); -fn recentLen(p: *Pardes) u64 { - var buf: [64]u8 = undefined; - var counting: std.Io.Writer.Discarding = .init(&buf); - pardes.panes.Output.recentText(p, &counting.writer, false) catch return 0; - return counting.fullCount(); -} - /// Declaration order is readdir order. pub const PaneFile = enum(u5) { dir = 0, @@ -643,23 +636,19 @@ fn attrOf(p: *Pardes, target: Target) ?Reply.Attr { fn topSize(p: *Pardes, f: TopFile) u64 { return switch (f) { - // ponytail: /screen has no length until an open renders its frame, - // and /pane/new none until an open has a pane to name. - .root, .pane, .col, .screen, .new => 0, - .layout => cols.layoutLen(p), + // Views generated whole by each read have no length, as acme's + // generated files have none: /screen until an open renders its + // frame, /pane/new until an open has a pane to name, and the index, + // layout, recent list and listeners, which a stat would otherwise + // have to build to count. + .root, .pane, .col, .screen, .new, .layout, .index, .recent, .listeners => 0, .tag => cols.headerText(p, null).?.len, - .index => pane.indexLen(p), .README => fs.help.len, .status => ctl.statusLen(p), .look, .exec, .tagexec => ctl.resultsLen(p), .log => events.logLen(&p.fs.log), - .listeners => listeners: { - var buf: [screen.listeners_cap]u8 = undefined; - break :listeners screen.listenersText(p, &buf).len; - }, .ctl => ctl.rootLen(p), .commands => ctl.commandsLen(), - .recent => recentLen(p), .focus => focus: { if (p.header_focus) break :focus 0; const pn = p.panes[p.active] orelse break :focus 0; -- cgit v1.3