summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 07:05:46 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit1b513045336b3c7381c447ffa8c9167f8b1a5a0a (patch)
treebf9377e7178f367c3ad0b35446f4aa9eaf9600d2 /src/exec.zig
parent96383331f09e8af3fa24f767b3c56863309723b8 (diff)
downloadpardes-1b513045336b3c7381c447ffa8c9167f8b1a5a0a.tar.gz
pardes-1b513045336b3c7381c447ffa8c9167f8b1a5a0a.zip
A builtin's Verbose announcement is logged only when it succeeds
A failure said while it ran (Exit's refusal, a Del refused) or later by the host (a Save's write, a Dump's) left `msg N Save` in the log as if it had worked. The announcement's record is remembered and taken back out on either, unless a follower read it already. A refused pane/new logs its err alone, and a failed Dump says its reason in words (`file not found`, not `FileNotFound`) so its msg goes and the err is the one record. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/exec.zig b/src/exec.zig
index c2d1be21..aee2e1e5 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -789,12 +789,22 @@ pub fn runBuiltinFrom(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ?
// A builtin says its own name before it runs, so a tagline click is
// legible even when what it did is invisible. Whatever the builtin
// then says for itself replaces the announcement.
+ // Its log record stands only if it does not fail (events.dropFailedAnnouncement).
+ var announced: ?u64 = null;
if (p.announce and p.settings.verbose and builtins.registry.announces(b)) {
p.setMessage(id, @tagName(b));
pane.msg_announcement = true;
+ announced = pardes.ctlfs.events.newestSaying(p, @tagName(b));
+ p.fs.announced_seq = announced;
+ const word = @tagName(b)[0..@min(@tagName(b).len, p.fs.announced_word.len)];
+ @memcpy(p.fs.announced_word[0..word.len], word);
+ p.fs.announced_word_len = @intCast(word.len);
}
+ const failures = p.fs.failures;
const c: builtins.Ctx = .{ .p = p, .pane = pane, .id = id, .txt = txt, .arg = arg, .from_body = from_body };
builtins.registry.dispatch(b, c);
+ if (announced != null and p.fs.failures != failures and p.fs.announced_seq == announced)
+ pardes.ctlfs.events.dropFailedAnnouncement(p, "", true);
}
pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]const u8) void {