summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 03:29:30 -0300
committerGabriel Schneider <[email protected]>2026-11-09 03:30:37 -0300
commit446292e15d56c9c248dae5d6fde1be3a83ade82e (patch)
tree859d8be8a92a18011034e614324fa1af5c99139e /src/ninep/ctl.zig
parentaabbccba49772cf73c7e35ae470245e9fda9d6ff (diff)
downloadpardes-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/ctl.zig')
-rw-r--r--src/ninep/ctl.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 2e362f77..ce92ba30 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -228,7 +228,7 @@ pub fn command(p: *Pardes, req: Req, serial: ?u32, exec: bool, in_tag: bool) Rep
}
if (p.panes[id] == null) return Reply.fail(req.tag, E.NOENT);
defer if (scratch) |s| if (v.active != s) if (p.panes[s]) |sp| if (sp.file) |f| {
- if (f.content.len == 0) p.removePane(s, null) catch {};
+ if (f.content.len == 0) p.removePane(s, null) catch |err| p.reportError(s, "exec", err);
};
p.fs.ran_at = p.panes[id].?.serial;
p.fs.no_pane_slot = false;
@@ -424,7 +424,7 @@ pub fn paneText(p: *Pardes, pane: *Pane, buf: *[pane_text_cap]u8) []const u8 {
fill: {
w.print("{d:>11} {d:>11} {d:>11} {d:>11} {d:>11} {d:>11} ", .{
pane.serial,
- pane_files.tagOf(p, pane).len,
+ if (pane_files.tagOf(p, pane)) |tag| tag.len else |_| 0, // a length, as a stat's: none when the tag cannot be made
// A terminal's body is its history, read whole on an open's first read.
if (pane.isTerminal()) panes.terminal.screenTextLen(pane) else pane_files.bodyOf(pane).len,
// A directory pane is one, as acme's isdir says.
@@ -722,7 +722,7 @@ pub fn fillPager(p: *Pardes, serial: u32, held: *std.ArrayList(u8)) error{OutOfM
const keyboard = p.view().active;
if (panes.Output.openDiff(p, id, f.path, f.content)) |hid| {
// ponytail: the text is gone with it; Diff on the +Diff says no such file.
- p.removePane(id, hid) catch {};
+ p.removePane(id, hid) catch |err| p.reportError(id, "pager", err);
} else |_| {}
if (p.panes[keyboard] != null) p.view().active = keyboard;
}
@@ -731,7 +731,7 @@ pub fn fillPager(p: *Pardes, serial: u32, held: *std.ArrayList(u8)) error{OutOfM
/// The editor's step: the text of /pager opens closed unread goes in.
pub fn fillClosedPagers(p: *Pardes) void {
for (p.fs.pages.items) |*page| {
- fillPager(p, page.serial, &page.bytes) catch {};
+ fillPager(p, page.serial, &page.bytes) catch |err| if (p.paneBySerial(page.serial)) |id| p.reportError(id, "pager", err);
page.bytes.deinit(p.gpa);
}
p.fs.pages.clearRetainingCapacity();
@@ -1359,7 +1359,7 @@ test "pane ctl read is acme's fields -- index's five, width in cells, font, tab
var want: std.ArrayList(u8) = .empty;
defer want.deinit(gpa);
try want.print(gpa, "{d:>11} {d:>11} {d:>11} {d:>11} {d:>11} {d:>11} {s} {d:>11} {d:>11} {d:>11} current mode:normal ", .{
- pane.serial, pane_files.tagOf(p, pane).len, @as(usize, 2), 0, 0, pane.cols, "default", config.tab_now, 0, 0,
+ pane.serial, (try pane_files.tagOf(p, pane)).len, @as(usize, 2), 0, 0, pane.cols, "default", config.tab_now, 0, 0,
});
try testing.expectEqualStrings(want.items, a.bytes);
try testing.expectEqual(@as(u64, a.bytes.len), call(p, .{ .tag = 1, .op = .getattr, .node = Node.of(pane.serial, .ctl) }).reply.attr.size);