From e22d77e95959a5babdc3eb693d0da317c1fae1b5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 23 Nov 2026 09:51:44 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- runtime/upgrade.zig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'runtime') 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 }); -- cgit v1.3