summaryrefslogtreecommitdiff
path: root/core/Messages.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Messages.zig')
-rw-r--r--core/Messages.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/Messages.zig b/core/Messages.zig
index 46dab136..18b10ff8 100644
--- a/core/Messages.zig
+++ b/core/Messages.zig
@@ -192,6 +192,7 @@ pub fn expireUnattended(p: *Pardes) void {
for (p.panes) |slot| {
const pane = slot orelse continue;
if (pane.msg_len == 0 and pane.msg_older_len == 0) continue;
+ if (awaited(p, pane)) continue;
if (now - pane.msg_said_ms < p.settings.message_linger_ms) continue;
pane.msg_len = 0;
pane.msg_life = .{};
@@ -200,10 +201,30 @@ pub fn expireUnattended(p: *Pardes) void {
}
}
+/// A message waits for someone to see it, and a view kept for its client's
+/// return (views.away: an Upgrade's clients, a divergence's) is someone
+/// on the way: what its keyboard's pane says (an Upgrade's outcome,
+/// upgrade.zig `tellEveryView`) is that client's until it is back for its
+/// view (Pardes.rejoinView: its join's dump has it) or the view's kept
+/// time is up; no other view's input and no unattended clock take it. A
+/// pair's one client is such a client; the session's own frontend is
+/// none (its view is never away). A session no build could load starts
+/// afresh with no view kept: a pair's is held attended for its client
+/// instead (tui.zig `Own.start`).
+fn awaited(p: *const Pardes, pane: *const Pane) bool {
+ if (p.views_away == 0) return false;
+ for (p.views, 0..) |slot, k| if (slot) |v| {
+ if (pardes.views.isAway(p, @intCast(k)) and p.panes[v.active] == pane and
+ p.clock.now_ns -| v.away_ns < pardes.views.away_kept_ns) return true;
+ };
+ return false;
+}
+
/// The key or click that used to clear the message row now starts each
/// line's exit: it stays `message_linger_ms`, then goes. A line already
/// on its way out keeps its own timing.
pub fn dismissMessage(p: *Pardes, pane: *Pane) void {
+ if (awaited(p, pane)) return;
if (pane.msg_len > 0 and dismissLine(p, &pane.msg_life)) {
pane.msg_len = 0;
pane.msg_life = .{};