summaryrefslogtreecommitdiff
path: root/core/colors.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 18:52:44 -0300
committerGabriel Schneider <[email protected]>2026-11-24 19:00:51 -0300
commitf26cf0be705280ff28ca69aaef6cc64e1466ed4e (patch)
tree73fa0cb9bb356644c516c38fd6e72724c4c5e234 /core/colors.zig
parente9f3712ce17f9813ecb15dbf76d46778a49c747d (diff)
downloadpardes-f26cf0be705280ff28ca69aaef6cc64e1466ed4e.tar.gz
pardes-f26cf0be705280ff28ca69aaef6cc64e1466ed4e.zip
messages: one session-wide list of live messages replaces each pane's stack of chips (pick-ui SPEC §10.1, walk UI line C item 1): Messages.Said is a kind (echo, notice, warn, error, question, progress), its cause first as a word a Look understands (a file's path, @pN and its command), its text, the places it names and the lines that explain it, the pane it is about, the question it asks, ×n and the core's clock, in a fixed list of 16 (Messages.live); a new message retires every echo and notice, a new error the error before it, the same message right after itself is counted, progress from the same cause runs in place and is never the notice row's; an echo or a notice dims after MessageLinger (now 4000 ms, a warning twice as long: test configs' MessageLinger 0 keep their meaning, nothing dims and nothing wakes), and the core sleeps to that dim (Messages.dimDue in nextWake) instead of a frame-counted linger; no key or click dismisses a message any more: Esc in normal mode takes the warnings and errors first, then goes back as before; every call site says what it said, mapped by its entry: setMessage a notice, setStatus progress, reportError and reportFailure an error, a builtin's announcement an echo (exec.zig), the sent-to-a-REPL arrow an echo; the log ring stays the history and 9P /log (each line now with its kind); gone: Pane.msg, msg_older and their lives, slots, announcement, status and sent flags, dismissMessage, advanceMessages, holdMessages, messageWake, expireUnattended and the detached shells' 100 ms message waits; until the notice row (item 2) a pane's one message chip shows the newest message said of it (Messages.saidBy); an Upgrade's outcome is said once and is every view's; tests: Messages.zig 'an echo or a notice retires those before it, an error the error before it, a repeat counts and progress runs in place', 'Msg says a notice by hand ... and the next message retires it', 'an idle core wants no wake, and a message wakes it once, when it dims', runtime/upgrade.zig 'an upgrade's outcome stays on every view's notice row until something else is said'; core-test 862 pass 162 skip, pane-test and shell-test pass; behaviour-test: the pdf addon's script golden and one PDF Restore test move with the chip over a PDF's body, which item 2 takes away
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/colors.zig')
-rw-r--r--core/colors.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/colors.zig b/core/colors.zig
index 5579ed05..e239d717 100644
--- a/core/colors.zig
+++ b/core/colors.zig
@@ -955,7 +955,7 @@ test "a theme file that cannot be read is named in the failure" {
requestThemeFile(p, 0, "/nowhere/mine.zon");
failThemeFile(p, p.theme_file_generation, error.FileNotFound);
const pane = p.panes[0].?;
- try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "theme file /nowhere/mine.zon: ") != null);
+ try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "theme file /nowhere/mine.zon: ") != null);
}
test "a theme file nested 10, 1 000 and 100 000 deep is refused in words, never a stack overflow" {
@@ -971,11 +971,11 @@ test "a theme file nested 10, 1 000 and 100 000 deep is refused in words, never
try source.appendSlice(gpa, "1");
for (0..depth) |_| try source.append(gpa, '}');
try source.appendSlice(gpa, " }\n");
- p.panes[0].?.msg_len = 0;
+ p.messages.live_len = 0;
// Up to 2026-11-23 std's parser took it: 5 000 deep overflowed the
// stack (a Debug build's 16 MiB).
try std.testing.expect(!loadThemeFile(p, p.theme_file_generation, source.items));
- const said = p.panes[0].?.msg[0..p.panes[0].?.msg_len];
+ const said = p.messages.saidBy(p.panes[0].?);
std.testing.expect(std.mem.indexOf(u8, said, "theme file /tmp/pardes-config/themes/deep.zon: ") != null) catch |err| {
std.debug.print("{d} deep: said {s}\n", .{ depth, said });
return err;
@@ -1016,7 +1016,7 @@ test "ThemeFile parses ZON atomically and Theme returns to the compiled ring" {
// A half-written save is rejected without disturbing the last good value.
try std.testing.expect(!loadThemeFile(p, request_effect.generation, ".{ .name = "));
// Said with its line, in words: never a bare `parse zon`.
- const said = p.panes[0].?.msg[0..p.panes[0].?.msg_len];
+ const said = p.messages.saidBy(p.panes[0].?);
try std.testing.expect(std.mem.indexOf(u8, said, ": line 1: ") != null and std.mem.indexOf(u8, said, "parse zon") == null);
try std.testing.expectEqualStrings("mine", p.theme().name);
try std.testing.expectEqual(@as(?[3]u8, .{ 1, 2, 3 }), p.theme().bg);