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/Messages.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Messages.zig') diff --git a/src/Messages.zig b/src/Messages.zig index 7970908e..d8aeea0c 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -487,7 +487,8 @@ pub fn clip(text: []const u8, max: usize) []const u8 { pub fn reportFailure(p: *Pardes, id: usize, text: []const u8) void { // A builtin a ctl write runs: its first error is also the write's, cut // between words. - if (p.fs.no_prompt and p.fs.failure_len == 0) { + const failing_write = p.fs.no_prompt or p.fs.capturing; + if (failing_write and p.fs.failure_len == 0) { const kept = if (text.len > p.fs.failure.len) clip(text, p.fs.failure.len - 3) else text; @memcpy(p.fs.failure[0..kept.len], kept); var n = kept.len; @@ -500,7 +501,7 @@ pub fn reportFailure(p: *Pardes, id: usize, text: []const u8) void { // The write fails with it, and its err record says it: no msg for it, // and no Verbose announcement before that, so the same failure again is // the same record again, counted (events.pushCounting). - if (p.fs.no_prompt) { + if (failing_write) { const serial: u32 = if (p.fs.session_write) 0 else if (id < MAX_PANES) if (p.panes[id]) |pane| pane.serial else 0 else 0; ctlfs.events.dropAnnouncement(p, serial, text); p.fs.unlogged = true; -- cgit v1.3