summaryrefslogtreecommitdiff
path: root/src/output_pane.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-06 17:14:15 -0300
committerGabriel Schneider <[email protected]>2026-09-06 17:14:15 -0300
commit1852dd3c1247ee66b4265b0a7ee8b3afd08a8fa5 (patch)
tree34f9bfba7439f80dfdd2870c716924f89d4cbf9f /src/output_pane.zig
parent8f34d29cb7b480545d25c68a8a6146deefdf0523 (diff)
downloadpardes-1852dd3c1247ee66b4265b0a7ee8b3afd08a8fa5.tar.gz
pardes-1852dd3c1247ee66b4265b0a7ee8b3afd08a8fa5.zip
messages: a fixed log of what the rows said, and a word to read it back
A message row is cleared by the next keystroke, so anything reported while you were looking at another pane was gone before you could read it — a save that failed, a watcher's reload, a builtin's complaint. `setMessage` now records into a fixed ring first: no allocation and no failure path, because it sits underneath `reportError`, which is reached from sites that are reporting an allocation failure. `Messages` (`SPC h m`) reads it back oldest-first. Three things an adversarial pass found, each of which defeated the feature: PROGRESS IS NOT A MESSAGE. A language server emits `Indexing 47%` several times a second, and every tick is a distinct string BY CONSTRUCTION, so no de-duplication can collapse it: at the client's one-per-150ms throttle it takes about nineteen seconds to push every real message out of the ring. A log that one indexing run empties is not a log. That path is `setStatus` now — the row, and nothing else. THE CLOCK MADE EVERY HOST MESSAGE UNIQUE. `message.stamp` prefixes `HH:MM:SS`, so `saved /x.zig` at 14:32:07 and at :09 compared unequal and the ring filled with rows that look identical and each say (x1) — exactly the case the de-duplication exists for. It compares `message.body` now, the row without its clock, and the newest wording wins so the row carries the last time it happened rather than the first. It also keys on the PANE (one pane's failure must not be recorded as another's) and compares the truncated form, so two identical messages over 256 bytes stop being two rows. AND THE CAPACITY BELONGS IN limits.zig. 128 entries is 32.75 KiB that is allocated whether or not anybody reads it — 8.5% of the ESP32-P4's whole 384 KiB heap, about the size of its effect ring. The board takes sixteen. The builtins/leader goldens move because the listing gains a row, and builtins.snap middle-clicks a SCREEN COORDINATE that Tutor moved out of; both updated selectively and verified against a fresh run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016Q4RATpafkwahrovHQLKRf
Diffstat (limited to 'src/output_pane.zig')
-rw-r--r--src/output_pane.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/output_pane.zig b/src/output_pane.zig
index 288c3e43..f4721136 100644
--- a/src/output_pane.zig
+++ b/src/output_pane.zig
@@ -519,6 +519,23 @@ pub fn openConfig(p: *Pardes, id: usize) !void {
return openRead(p, id, .{ .cmd = .Config }, "", content);
}
+/// The message-row log, oldest first — the lines that were said in passing and
+/// then cleared by the next keystroke.
+pub fn openMessages(p: *Pardes, id: usize) !void {
+ var out: std.Io.Writer.Allocating = .init(p.gpa);
+ errdefer out.deinit();
+ var i: usize = 0;
+ while (p.messageLog(i)) |m| : (i += 1) {
+ if (m.pane != 0xff) try out.writer.print("{d}: ", .{m.pane});
+ try out.writer.writeAll(m.slice());
+ if (m.repeats > 1) try out.writer.print(" (x{d})", .{m.repeats});
+ try out.writer.writeByte('\n');
+ }
+ if (i == 0) try out.writer.writeAll("nothing has been said yet\n");
+ const content = try out.toOwnedSlice();
+ return openRead(p, id, .{ .cmd = .Messages }, "", content);
+}
+
/// The version banner plus the embedded CHANGELOG, so an installed binary can
/// say what it is and what changed without a repository beside it.
pub fn openChangelog(p: *Pardes, id: usize) !void {