From 554181b73fd53b898841203066382e4287b83e89 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 06:05:08 -0300 Subject: One rule for failing builtins: the write fails, one err, no msg A builtin that failed through a ctl failed the write and logged its err, but through look, exec, tagexec or a column's exec it only said so on the message row, logged as a msg, and the write succeeded. Now every click write runs its builtin as a ctl line does (ctl.captured): a failure fails the write, with its words (EINVAL for malformed input, else EIO or what the words name), logs one err and no msg or announcement. get's Modified and a look miss are shown but logged once, as their err. A control character's refusal names its reason, a failed click reads back nothing, and look never reads back a pane closed since. The special case for a cut-short Edit through exec goes (the rule covers it); fs.md's table of exceptions becomes the one rule, as does the skill. Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 6ca216e3..dfd1e84c 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -946,21 +946,7 @@ pub const Edit = struct { var why: sam.Why = .{}; var said: [260]u8 = undefined; const res = sam.run(arena, f.content, ninep_pane.dotOf(c.pane), f.path, c.arg orelse "", &why) catch |err| switch (err) { - error.Edit => { - const text = std.fmt.bufPrint(&said, "Edit: {s}", .{why.text()}) catch "Edit: failed"; - // A block cut short (no `.` line, no `}`) that came over - // 9P through an exec, whose write does not fail for what - // a command says, is still the write's fault: an err. - const cut = std.mem.eql(u8, why.text(), "unmatched `{'") or std.mem.startsWith(u8, why.text(), "a, c or i text not ended"); - if (cut and c.p.fs.serving and !c.p.fs.no_prompt) { - var rec: [300]u8 = undefined; - pardes.ctlfs.events.notePath(c.p, "err", std.fmt.bufPrint(&rec, "{d} exec: {s}", .{ c.pane.serial, text }) catch "- exec: Edit failed"); - c.p.fs.unlogged = true; - defer c.p.fs.unlogged = false; - return c.p.reportFailure(c.id, text); - } - return c.p.reportFailure(c.id, text); - }, + error.Edit => return c.p.reportFailure(c.id, std.fmt.bufPrint(&said, "Edit: {s}", .{why.text()}) catch "Edit: failed"), error.OutOfMemory => return c.p.reportError(c.id, "Edit", err), }; if (res.undo != 0) { -- cgit v1.3