summaryrefslogtreecommitdiff
path: root/runtime/upgrade.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 09:51:44 -0300
committerGabriel Schneider <[email protected]>2026-11-23 10:04:38 -0300
commite22d77e95959a5babdc3eb693d0da317c1fae1b5 (patch)
treee104da3ea9eef182ce8fcf66a4acf5b43ba4b2a8 /runtime/upgrade.zig
parent7dbcaa13cc3bebd5470ce1ac3f5e112357564063 (diff)
downloadpardes-e22d77e95959a5babdc3eb693d0da317c1fae1b5.tar.gz
pardes-e22d77e95959a5babdc3eb693d0da317c1fae1b5.zip
upgrade: an Upgrade's outcome is the session's news: `tellEveryView` says it at each open view's keyboard pane, a pane two views share once (the coordinator's ruling: every view that has a frontend reads it on its own screen), where `load` said it at the live view alone, the one whose input came last before the Upgrade's step; the test of the change before passes (Debug, 8/8 of the filter)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime/upgrade.zig')
-rw-r--r--runtime/upgrade.zig14
1 files changed, 13 insertions, 1 deletions
diff --git a/runtime/upgrade.zig b/runtime/upgrade.zig
index 2fa910aa..e7b6553a 100644
--- a/runtime/upgrade.zig
+++ b/runtime/upgrade.zig
@@ -436,7 +436,7 @@ pub fn load(gpa: std.mem.Allocator, core_gpa: std.mem.Allocator, opts: pardes.Op
// keep its blocks for as long as this session runs.
if (rec.old >= 0) _ = libc.close(rec.old);
rec.old = -1;
- p.setMessage(.at(p.view().active), if (rec.refused.len > 0)
+ tellEveryView(p, if (rec.refused.len > 0)
std.fmt.bufPrint(&buf, "Upgrade: the new build could not load this session ({s}); it goes on as {s}", .{ rec.refused[0..@min(rec.refused.len, 200)], version_line }) catch "Upgrade: the new build could not load this session; it goes on as before"
else
"Upgrade: now " ++ version_line);
@@ -463,6 +463,18 @@ pub fn load(gpa: std.mem.Allocator, core_gpa: std.mem.Allocator, opts: pardes.Op
}
}
+/// An Upgrade is the session's news, not the asking view's: said in every
+/// view at the pane its keyboard is on (each client reads it on its own
+/// screen), a pane two views are on once; the live view is only the one
+/// whose input came last before the dump.
+fn tellEveryView(p: *pardes.Pardes, text: []const u8) void {
+ var told: [pardes.MAX_PANES]bool = @splat(false);
+ for (p.views) |v| if (v) |view| if (!told[view.active]) {
+ told[view.active] = true;
+ p.setMessage(.at(view.active), text);
+ };
+}
+
test "an upgrade's outcome is said in every view, at the pane its keyboard is on, whichever view's input came last" {
const gpa = std.testing.allocator;
const p = try pardes.Pardes.init(gpa, .{ .tty_only = true });