summaryrefslogtreecommitdiff
path: root/runtime/upgrade.zig
diff options
context:
space:
mode:
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 });