diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-09 03:29:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-09 03:30:37 -0300 |
| commit | 446292e15d56c9c248dae5d6fde1be3a83ade82e (patch) | |
| tree | 859d8be8a92a18011034e614324fa1af5c99139e /src/ninep/pane.zig | |
| parent | aabbccba49772cf73c7e35ae470245e9fda9d6ff (diff) | |
| download | pardes-446292e15d56c9c248dae5d6fde1be3a83ade82e.tar.gz pardes-446292e15d56c9c248dae5d6fde1be3a83ade82e.zip | |
idioms: the 9P tree's swallows decided: a directory read stages every entry or answers ENOMEM (stageDirent and sources.stage return error{OutOfMemory}, readdir's entries made by stageDir, an /os listing whose buffer fills ends there), a pane's tag read through tagOf fails by name (a read or an event write answers ENOMEM, a stat's length and ctl's line say 0), a pane that cannot close (removePane's nine swallowing callers) and a /pager text that cannot go in (fillClosedPagers) are said on their pane, and Queue.push says once why a lost record is not said
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 519e5333..ce246465 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -131,8 +131,8 @@ pub fn fileOf(pane: *Pane) ?*panes.File.State { return if (pane.file) |*f| f else null; } -pub fn tagOf(p: *Pardes, pane: *Pane) []const u8 { - return tagline.tagText(p, p.scratch.allocator(), pane) catch ""; +pub fn tagOf(p: *Pardes, pane: *Pane) error{OutOfMemory}![]const u8 { + return tagline.tagText(p, p.scratch.allocator(), pane); } pub fn dirtyOf(pane: *const Pane) bool { @@ -320,7 +320,7 @@ pub fn fileSize(p: *Pardes, id: usize, f: PaneFile) u64 { // What addr selects, generated by each read: no length, as acme's // data and xdata have none. .data, .xdata => 0, - .tag => tagOf(p, pane).len, + .tag => if (tagOf(p, pane)) |tag| tag.len else |_| 0, // a stat's length is a hint: none when the tag cannot be made .name => nameOf(p, pane).len + 1, .ctl => ctl: { var buf: [ctl.pane_text_cap]u8 = undefined; @@ -374,7 +374,7 @@ 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); - break :tag tree.window(p, req, tagOf(p, pane)); + break :tag tree.window(p, req, tagOf(p, pane) catch break :tag Reply.fail(req.tag, E.NOMEM)); }, .ctl => ctl: { var buf: [ctl.pane_text_cap]u8 = undefined; |
