summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 21:19:57 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit137dc2ea4be0fc5baf4cab1d8a757ce426e5cbb2 (patch)
treeb4dba1252b54a135c5afe972bf4193f31219703a /src/ninep/tree.zig
parentf02c10bfa6d02d305ddb6d7a28b12c40035274c7 (diff)
downloadpardes-137dc2ea4be0fc5baf4cab1d8a757ce426e5cbb2.tar.gz
pardes-137dc2ea4be0fc5baf4cab1d8a757ce426e5cbb2.zip
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 <[email protected]>
Diffstat (limited to 'src/ninep/tree.zig')
-rw-r--r--src/ninep/tree.zig23
1 files changed, 6 insertions, 17 deletions
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;