diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 18:52:44 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 19:00:51 -0300 |
| commit | f26cf0be705280ff28ca69aaef6cc64e1466ed4e (patch) | |
| tree | 73fa0cb9bb356644c516c38fd6e72724c4c5e234 /core | |
| parent | e9f3712ce17f9813ecb15dbf76d46778a49c747d (diff) | |
| download | pardes-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')
| -rw-r--r-- | core/Core.zig | 60 | ||||
| -rw-r--r-- | core/Db.zig | 2 | ||||
| -rw-r--r-- | core/Effect.zig | 2 | ||||
| -rw-r--r-- | core/File.zig | 2 | ||||
| -rw-r--r-- | core/Jump.zig | 2 | ||||
| -rw-r--r-- | core/Messages.zig | 695 | ||||
| -rw-r--r-- | core/Pipe.zig | 2 | ||||
| -rw-r--r-- | core/Plumb.zig | 6 | ||||
| -rw-r--r-- | core/Query.zig | 2 | ||||
| -rw-r--r-- | core/Term.zig | 4 | ||||
| -rw-r--r-- | core/builtins.zig | 6 | ||||
| -rw-r--r-- | core/colors.zig | 8 | ||||
| -rw-r--r-- | core/config.zig | 7 | ||||
| -rw-r--r-- | core/draw.zig | 6 | ||||
| -rw-r--r-- | core/edit.zig | 4 | ||||
| -rw-r--r-- | core/edit_cmd.zig | 2 | ||||
| -rw-r--r-- | core/exec.zig | 14 | ||||
| -rw-r--r-- | core/jj.zig | 5 | ||||
| -rw-r--r-- | core/keys.zig | 2 | ||||
| -rw-r--r-- | core/look.zig | 8 | ||||
| -rw-r--r-- | core/lsp/Ask.zig | 6 | ||||
| -rw-r--r-- | core/mouse.zig | 6 | ||||
| -rw-r--r-- | core/ninep/ctl.zig | 2 | ||||
| -rw-r--r-- | core/ninep/events.zig | 14 | ||||
| -rw-r--r-- | core/normal.zig | 2 | ||||
| -rw-r--r-- | core/panes.zig | 98 | ||||
| -rw-r--r-- | core/root.zig | 2 |
27 files changed, 423 insertions, 546 deletions
diff --git a/core/Core.zig b/core/Core.zig index 835eb86c..a4c1d086 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -350,8 +350,8 @@ chrome: colors.ChromeTheme = colors.initial_chrome, frames: *FrameStats = undefined, own_frames: FrameStats = .{}, quit: bool = false, -/// A detached session with no frontend attached: nothing renders, so -/// no input ever dismisses a message (Messages.expireUnattended). +/// A detached session with no frontend attached: nothing renders, and a +/// 9P write may size its view (ninep/ctl.zig `size`). unattended: bool = false, haptic: HapticSlot = if (platform == .macos) .none else {}, /// The look just run found nothing (look.zig missed). @@ -1576,11 +1576,6 @@ pub fn pump(p: *Pardes, host: Host) !void { } else 0; _ = p.tape.host(p, .wait_input, .{timeout}); } - // Detached, nobody's key dismisses a message: they go on the clock, - // here in the step, where the clock read is taped (the host's wait - // did it, untaped, and a replay kept a message its session had let - // go). - Messages.expireUnattended(p); p.frames.mark_start = FrameStats.nowNs(); if (p.tape.host(p, .now, .{})) |now| p.advance(now); p.settle(); @@ -1708,11 +1703,6 @@ fn updateInner(p: *Pardes, ev: Event) void { // the screen. p.needs_frame = p.needs_frame or ev != .tick; p.shell_rows.sweep(p.gpa); - Messages.expireUnattended(p); - // An announcement stands in only until its own step says more. - for (p.panes) |slot| if (slot) |pane| { - pane.msg_announcement = false; - }; // A Look's hover outlives a tick, a batch of rows coming in (no // gesture), a move with no button, and a change to another pane. const hover_stays = switch (ev) { @@ -1727,15 +1717,9 @@ fn updateInner(p: *Pardes, ev: Event) void { look.cancelLookHover(p); } switch (ev) { - .key, .mouse => { - for (p.panes) |slot| { - if (slot) |pane| Messages.dismissMessage(p, pane); - } - v.clip_pending = null; - }, + .key, .mouse => v.clip_pending = null, .tick => { Stream.step(p); - Messages.advanceMessages(p); for (0..p.panes.len) |id| exec.flushReplEnter(p, id, false); }, else => {}, @@ -1902,10 +1886,10 @@ pub const SavePath = Effect.Buf(effect_path_cap); pub const noteLateFailure = pardes.tape.taped(noteLateFailureInner); fn noteLateFailureInner(p: *Pardes, id: Pane.Id) void { // Said by reportFailure just now: its words fitted whole, the - // reason kept; else what the message row has. + // reason kept; else what was said of the pane last. const said = if (p.fs.said_at == p.fs.failures and p.fs.said_len > 0) p.fs.said[0..p.fs.said_len] - else if (p.panes[id.index()]) |pane| pane.msg[0..pane.msg_len] else return; + else if (p.panes[id.index()]) |pane| p.messages.saidBy(pane) else return; const kept = @import("Messages.zig").clip(said, p.fs.late_failure.len); @memcpy(p.fs.late_failure[0..kept.len], kept); p.fs.late_failure_len = @intCast(kept.len); @@ -2164,10 +2148,11 @@ pub fn nextWake(p: *const Pardes) ?u64 { const delay = config.look_preview_delay_frames; frames = @max(1, delay -| waiting.frames); } - for (p.panes) |slot| if (slot) |pane| { - const wait = Messages.messageWake(p, pane) orelse continue; + // A message dims at the end of its bright time. + if (Messages.dimDue(p)) |due| { + const wait = @max(1, (due - p.clock.stepped_ns + frame_ns - 1) / frame_ns); frames = if (frames) |soonest| @min(soonest, wait) else wait; - }; + } // Del's question goes up at the end of its delay: a frame then, and // none after (stepped time has reached it). for (p.panes) |slot| if (slot) |pane| if (pane.prompt == .del_side and pane.question_due_ns > p.clock.stepped_ns and pane.question_due_ns != Pane.question_asked) { @@ -2225,7 +2210,6 @@ fn advanceInner(p: *Pardes, now_ns: u64) void { // Only waiting until `due`: its counters move there at once. const held = (due - p.clock.stepped_ns) / frame; if (held > 1) { - Messages.holdMessages(p, held - 1); if (p.look_hover_wait) |*waiting| waiting.frames +|= @intCast(@min(held - 1, std.math.maxInt(u16))); p.clock.stepped_ns += (held - 1) * frame; } @@ -2621,14 +2605,13 @@ test "TreeContext rows in the tag style keep the message rows" { p.update(.{ .resize = .{ .cols = 60, .rows = 16, .row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 6, .tagline_h = 12 } } }); pane.file.?.tree_context = true; pane.file.?.scroll = 8; - pane.msg_len = 0; + p.messages.live_len = 0; p.sync(); _ = try p.render(p.scratch.allocator()); const full_height = p.surface.body_layers[0].viewport.h; try std.testing.expect(p.surface.body_layers[0].rows > full_height); try std.testing.expectEqual(FontRole.tagline, p.surface.body_layers[0].cells[0].style.font_role); - pane.msg[0] = '!'; - pane.msg_len = 1; + _ = Messages.keep(p, .notice, pane.serial, "", "!"); p.sync(); _ = try p.render(p.scratch.allocator()); // An overlay takes nothing: the message is a chip OVER the body's first @@ -2645,7 +2628,7 @@ test "TreeContext rows in the tag style keep the message rows" { try std.testing.expectEqual(r.x + r.w, band.viewport.x + band.viewport.w); try std.testing.expect(band.viewport.w < r.w - config.GUTTER); try std.testing.expectEqualStrings("!", band.cells[layout.tagCapacity(p, band.viewport.w) - 2].grapheme()); - pane.msg_len = 0; + p.messages.live_len = 0; p.view().prefix = .leader; p.sync(); _ = try p.render(p.scratch.allocator()); @@ -3032,7 +3015,7 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe try std.testing.expect(file.repl == null); try std.testing.expect(p.executeBuiltinLine(1, "Repl pithon")); try std.testing.expect(p.panes[1].?.repl == null); - try std.testing.expect(std.mem.indexOf(u8, p.panes[1].?.msg[0..p.panes[1].?.msg_len], "python") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(p.panes[1].?), "python") != null); try std.testing.expect(p.executeBuiltinLine(1, "Repl python")); // again, as a code fence may name it: no change try std.testing.expect(p.executeBuiltinLine(1, "Repl PY")); @@ -3046,8 +3029,7 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe Sent.drain(p); try std.testing.expectEqualStrings("ls\r", Sent.said(1)); try std.testing.expect(!Sent.spawned); - try std.testing.expect(file.msg_sent); - try std.testing.expectEqualStrings("\u{2192} python-a", file.msg[0..file.msg_len]); + try std.testing.expectEqualStrings("\u{2192} python-a", p.messages.saidBy(file)); // A body's click written back to event is done as the click: sent. A // line written to exec came back as F and runs as the command it was. { @@ -3170,7 +3152,7 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe p.update(.{ .key = .{ .cp = 'b' } }); Sent.drain(p); try std.testing.expect(Sent.len[1] == 0 and Sent.len[2] == 0); - try std.testing.expectEqualStrings("Repl: the REPL chosen is gone; nothing sent", file.msg[0..file.msg_len]); + try std.testing.expectEqualStrings("Repl: the REPL chosen is gone; nothing sent", p.messages.saidBy(file)); try std.testing.expect(p.executeBuiltinLine(2, "Repl python")); try std.testing.expectEqualStrings("python-b", exec.replId(&idbuf, p.panes[2].?)); @@ -3187,7 +3169,7 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe try std.testing.expectEqual(Pane.Prompt.none, file.prompt); Sent.drain(p); try std.testing.expect(Sent.len[1] == 0 and Sent.len[2] == 0 and !Sent.spawned); - try std.testing.expect(std.mem.indexOf(u8, file.msg[0..file.msg_len], "no program running") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(file), "no program running") != null); host.taken[1] = true; host.taken[2] = true; @@ -3197,7 +3179,7 @@ test "a REPL bound for a language takes the exec made on a body in it; tags, Exe try std.testing.expect(p.executeBuiltinLine(1, "Repl python")); try std.testing.expectEqualStrings("python-a", exec.replId(&idbuf, p.panes[1].?)); try std.testing.expect(p.executeBuiltinLine(2, "Repl")); - try std.testing.expectEqualStrings("Repl: python-b", p.panes[2].?.msg[0..p.panes[2].?.msg_len]); + try std.testing.expectEqualStrings("Repl: python-b", p.messages.saidBy(p.panes[2].?)); // A command pane is a REPL while its command runs: done, it is none, // and a done one cannot be bound. A document pane is no terminal. @@ -3276,13 +3258,13 @@ test "Term+fish, one word a tag can hold, opens a terminal on that shell" { const caller = p.panes[0].?; try std.testing.expect(p.executeBuiltinLine(0, "Term /nonexistent")); try std.testing.expect(p.view().active == before and caller.shell == null); - try std.testing.expect(std.mem.indexOf(u8, caller.msg[0..caller.msg_len], "shell \"/nonexistent\" not found") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(caller), "shell \"/nonexistent\" not found") != null); try std.testing.expect(p.executeBuiltinLine(0, "Term fsh-not-a-shell")); try std.testing.expect(caller.shell == null); // A directory passes access(X_OK); it is no shell either. try std.testing.expect(p.executeBuiltinLine(0, "Term /etc")); try std.testing.expect(p.view().active == before); - try std.testing.expect(std.mem.indexOf(u8, caller.msg[0..caller.msg_len], "Term: not a shell: /etc is a directory") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(caller), "Term: not a shell: /etc is a directory") != null); // Only a word that says so splits at `+`: `Dump+x.zon` is no Dump. try std.testing.expect(!p.executeBuiltinLine(0, "Dump+x.zon")); try std.testing.expect(!p.executeBuiltinLine(0, "Msg+hello")); @@ -3642,7 +3624,7 @@ test "Tab N draws every pane's tab N cells wide and clicks count past it; bare T try std.testing.expectEqual(@as(i32, 1), pane.body.cur_col); // Bare, it says the width. try std.testing.expect(p.executeBuiltinLine(0, "Tab")); - try std.testing.expectEqualStrings("Tab 8", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("Tab 8", p.messages.saidBy(pane)); // Out of range: refused, the width kept. try std.testing.expect(p.executeBuiltinLine(0, "Tab 0")); try std.testing.expectEqual(@as(u16, 8), p.settings.tab); @@ -4072,7 +4054,7 @@ test "bytes for a terminal past what may wait for it are dropped and said, never p.emitWrite(0, big); try std.testing.expectEqual(@as(usize, 0), p.pending_write_bytes); const pane = p.panes[0].?; - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "dropped") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "dropped") != null); } test "a bracketed paste larger than the ring still closes its bracket" { diff --git a/core/Db.zig b/core/Db.zig index eb8ee20c..4131ccbc 100644 --- a/core/Db.zig +++ b/core/Db.zig @@ -1424,7 +1424,7 @@ test "state file: Recent is read once from the file it replaced, else from the s defer c.deinit(); try testing.expectEqual(@as(usize, 0), c.recent.entries.items.len); const pane = c.panes[c.view().active].?; - try testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "Recent: the files before the state file were not read") != null); + try testing.expect(std.mem.indexOf(u8, c.messages.saidBy(pane), "Recent: the files before the state file were not read") != null); } // Both left where they were. _ = try tmp.dir.statFile(testing.io, "old/recent", .{}); diff --git a/core/Effect.zig b/core/Effect.zig index bf02c5b7..3bca04c9 100644 --- a/core/Effect.zig +++ b/core/Effect.zig @@ -346,7 +346,7 @@ test "Detach asks the host to let its terminal go, and says so when there is not p.perform(.{ .detach = asked }); const pane = p.panes[0].?; - try std.testing.expectEqualStrings("detach: not attached", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("detach: not attached", p.messages.saidBy(pane)); try std.testing.expect(!p.quit); } diff --git a/core/File.zig b/core/File.zig index 07dfa52d..58544b62 100644 --- a/core/File.zig +++ b/core/File.zig @@ -3524,7 +3524,7 @@ test "a text replaced whole keeps its old buffer for its undo, swapped back and setContent(p, f, try gpa.dupe(u8, t)); } try std.testing.expectEqual(@as(usize, 2), j.done); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "undo keeps the last two texts replaced whole") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "undo keeps the last two texts replaced whole") != null); try undoStep(p, pane, true); try undoStep(p, pane, true); try std.testing.expectEqualStrings(texts[1], f.content); diff --git a/core/Jump.zig b/core/Jump.zig index a83b6ab4..4a7c1e40 100644 --- a/core/Jump.zig +++ b/core/Jump.zig @@ -158,7 +158,7 @@ const JumpsTest = struct { try out.print("{s}{c}{d}", .{ if (out.end > 0) " " else "", letters[which], pane.body.cur_row + 1 }); } else return error.NoEnd; const pane = t.p.panes[t.p.view().active].?; - const said = pane.msg[0..pane.msg_len]; + const said = t.p.messages.saidBy(pane); try std.testing.expect(std.mem.indexOf(u8, said, if (delta < 0) "nothing further back" else "nothing further on") != null); return out.buffered(); } diff --git a/core/Messages.zig b/core/Messages.zig index 040b8d2c..747e5e2f 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -1,6 +1,9 @@ -//! The message row: messages and statuses a pane shows between its body and -//! its tagline, how each line lingers once dismissed, the notices -//! built from them every frame, and the log of everything said. +//! The session's messages (pick-ui SPEC §10): each a kind, its cause as a +//! word a Look understands, its text, the places it names and the lines +//! that explain it, kept in a fixed list while it lives; the log of +//! everything said behind them (the history, `SPC h m`, and 9P `/log`); +//! and the transient bands a pane shows over its body's top rows (the +//! pending leader chord, a prompt waiting for input). const pardes = @import("root.zig"); const memory = @import("memory.zig"); const std = @import("std"); @@ -16,12 +19,14 @@ const BOX_H = pardes.BOX_H; const Key = pardes.Key; const Rect = layout.Rect; const Pardes = pardes.Pardes; +const Buf = pardes.Kind.Buf; const Messages = @This(); /// Where its ring's next line goes and how many it holds, held to the ring -/// where a dump is read back (walk.zig `.place`). -pub const replica = .{ .place = .{ .{ "head", "lastSlot" }, .{ "len", "size" } } }; +/// where a dump is read back (walk.zig `.place`); the live messages as far +/// as they go. +pub const replica = .{ .place = .{ .{ "head", "lastSlot" }, .{ "len", "size" } }, .len = .{.{ "live", "live_len" }} }; /// The message-row log: a fixed ring, never allocated, never grown. See /// `logMessage` and the `Messages` builtin. @@ -29,6 +34,14 @@ log: [limits.message_log]LoggedMessage = @splat(.{}), /// Next slot to write. `len` saturates at the ring's size. head: usize = 0, len: usize = 0, +/// The messages that live, oldest first: what the notice row, the marks +/// and the ghosts at a cause's line are drawn from each frame. +live: [max_live]Said = undefined, +live_len: u8 = 0, + +/// How many messages live at once: past it the oldest that is no +/// question goes (a burst of distinct ones; a repeat only counts). +pub const max_live = 16; pub fn lastSlot(m: *const Messages) usize { return m.log.len - 1; @@ -38,6 +51,111 @@ pub fn size(m: *const Messages) usize { return m.log.len; } +/// What a message is, which says how long it lives (SPEC §10.1): an echo +/// and a notice until the next message, bright for `MessageLinger`; a +/// warning bright twice that, until Esc; an error until Esc or the next +/// error; a question until it is answered; progress while it runs, at the +/// right end of its tag rather than on the notice row. +pub const Kind = enum(u8) { + echo, + notice, + warn, + @"error", + question, + progress, + + pub fn glyph(k: Kind) []const u8 { + return switch (k) { + .echo => "\u{2713}", + .notice => "\u{b7}", + .warn => "!", + .@"error" => "\u{2717}", + .question => "?", + .progress => "\u{22ef}", + }; + } + + /// Which wins the notice row and a mark: error, question, warning, + /// notice, echo; progress never. + pub fn rank(k: Kind) u8 { + return switch (k) { + .progress => 0, + .echo => 1, + .notice => 2, + .warn => 3, + .question => 4, + .@"error" => 5, + }; + } +}; + +/// A place a message names: a file's line and column, and what it says +/// there (a compiler's `error: ...`), which the body shows at that line. +pub const Place = struct { + path: Buf(256) = .{}, + line: u32 = 1, + col: u32 = 1, + text: Buf(128) = .{}, +}; + +/// The questions the session asks in the background, and their answers. +pub const Ask = enum(u8) { + none, + /// A file changed on disk under unsaved text. + disk, +}; + +/// One live message. +pub const Said = struct { + pub const replica = .{ .len = .{ .{ "places", "places_len" }, .{ "detail", "detail_len" } } }; + pub const max_places = 4; + pub const max_detail = 4; + kind: Kind = .notice, + /// Its cause, first, as a word a Look understands: a file's path, a + /// pane's `@pN` (and its command), a server's name. + src: Buf(96) = .{}, + text: Buf(256) = .{}, + places: [max_places]Place = undefined, + places_len: u8 = 0, + /// The lines that explain it, shown under its first place's line while + /// the caret is on it. + detail: [max_detail]Buf(128) = undefined, + detail_len: u8 = 0, + /// The serial of the pane it is about, 0 for none in particular. + pane: u32 = 0, + asks: Ask = .none, + /// How many times in a row it was said. + n: u16 = 1, + /// When it was last said, on the core's clock (`Pardes.clock.now_ns`). + t: u64 = 0, + + /// Its words without the clock a host stamped on them (Message.stamp). + pub fn words(s: *const Said) []const u8 { + return Message.body(s.text.slice()); + } + + /// Whether it has dimmed: an echo or a notice past `linger_ms`, a + /// warning past twice that. + pub fn faded(s: *const Said, now_ns: u64, linger_ms: u16) bool { + const bright: u64 = switch (s.kind) { + .echo, .notice => linger_ms, + .warn => 2 * @as(u64, linger_ms), + else => return false, + }; + return now_ns -| s.t >= bright * std.time.ns_per_ms; + } + + /// Whether it is about `pane`: said of it, or naming its file (as its + /// cause or among its places). + pub fn about(s: *const Said, pane: *const Pane) bool { + if (s.pane != 0 and s.pane == pane.serial) return true; + const f = pane.file orelse return false; + if (std.mem.eql(u8, s.src.slice(), f.path)) return true; + for (s.places[0..s.places_len]) |*place| if (std.mem.eql(u8, place.path.slice(), f.path)) return true; + return false; + } +}; + pub const LoggedMessage = struct { pub const cap = 256; pub const replica = .{ .len = .{.{ "text", "len" }} }; @@ -50,6 +168,7 @@ pub const LoggedMessage = struct { /// How many times in a row. Saturating: a key held down against the same /// refusal is one event, not four hundred. repeats: u16 = 0, + kind: Kind = .notice, pub fn slice(m: *const LoggedMessage) []const u8 { return m.text[0..m.len]; @@ -137,195 +256,168 @@ pub const Message = struct { } }; -/// A status updates the message line in place (a progress count does not -/// pile up); a message is an event, and stacks. + +/// A status updates its line in place (a progress count does not pile up), +/// and is not logged; a message is an event. pub const setStatus = pardes.tape.taped(setStatusInner); fn setStatusInner(p: *Pardes, id: Pane.Id, text: []const u8) void { - showMessage(p, id.index(), text, false); + say(p, .progress, id.index(), text); } pub const setMessage = pardes.tape.taped(setMessageInner); fn setMessageInner(p: *Pardes, id: Pane.Id, text: []const u8) void { - logMessage(p, id.index(), text); - showMessage(p, id.index(), text, true); + say(p, .notice, id.index(), text); +} + +/// Say `text`, a message of `kind` about pane `id` (MAX_PANES and up: +/// none in particular), its cause first: logged (progress is not), and +/// live (`keep`). +pub fn say(p: *Pardes, kind: Kind, id: usize, text: []const u8) void { + if (kind != .progress) logMessage(p, id, kind, text); + const pane: ?*Pane = if (id < MAX_PANES and !p.fs.session_write) p.panes[id] else null; + var src: Buf(96) = .{}; + if (pane) |cause| { + if (cause.file) |f| src.set(f.path) else if (cause.command) |line| { + const first = line[0 .. std.mem.indexOfAny(u8, line, "\r\n") orelse line.len]; + var cut = @min(first.len, 64); + while (cut < first.len and cut > 0 and first[cut] & 0xC0 == 0x80) cut -= 1; + _ = src.print(config.pane_addr ++ "{d} {s}", .{ cause.serial, first[0..cut] }); + } else _ = src.print(config.pane_addr ++ "{d}", .{cause.serial}); + } + _ = keep(p, kind, if (pane) |cause| cause.serial else 0, src.slice(), text); } -fn showMessage(p: *Pardes, id: usize, text: []const u8, stack: bool) void { - if (id >= MAX_PANES) return; - const pane = p.panes[id] orelse return; +/// Make a message live, and return it (for its places and its detail): +/// a new message retires every echo and notice, a new error the error +/// before it; the same message again right after itself is counted. The +/// list is in the order things were said. +pub fn keep(p: *Pardes, kind: Kind, serial: u32, src: []const u8, text: []const u8) *Said { + const m = &p.messages; + p.needs_frame = true; // One row of printable text: a language server's multi-line report // reads as one line, and the cut never leaves half a glyph behind. - var n: usize = @min(text.len, pane.msg.len); + var row: [256]u8 = undefined; + var n: usize = @min(text.len, row.len); if (n < text.len) { while (n > 0 and text[n] & 0xC0 == 0x80) n -= 1; } - const same = pane.msg_len == n and for (text[0..n], pane.msg[0..n]) |c, have| { - if ((if (c < 0x20 or c == 0x7f) ' ' else c) != have) break false; - } else true; - // A new event moves the line on screen up the stack, where it keeps - // its own timing, and falls in below it. - // Only an event stacks on an event: an announcement or a status - // stands in for whatever comes next. - if (stack and pane.msg_len > 0 and !same and !pane.msg_announcement and !pane.msg_status) - pane.pushOlderMessage(); - if (pane.msg_len == 0) pane.msg_slot = pane.freeMessageSlot(); - pane.msg_announcement = false; - pane.msg_sent = false; - pane.msg_status = !stack; - for (text[0..n], pane.msg[0..n]) |c, *cell| cell.* = if (c < 0x20 or c == 0x7f) ' ' else c; - pane.msg_len = @intCast(n); - // The clock when it was said (the session clock is the last pump's, - // and a 9P write after an idle hour would say it an hour ago). - pane.msg_said_ms = p.tape.value(.clock, nowMs, .{}); - p.needs_frame = true; - // New, the same line again or a status update: fresh, so it stays. - pane.msg_life = .{}; -} - -/// With no frontend attached no input dismisses a message, and a detached -/// session's /screen and messages kept what was said an hour ago: each -/// pane's lines go once its newest has been up `message_linger_ms`, on the -/// clock, checked as the core is stepped (each event, and each pump after -/// its wait, which a message wakes) -- not as a 9P request is served, since -/// a read is answered while a step is out and must change nothing, nor by -/// the host, whose call is no input a replay makes. -/// ponytail: a pane's older lines go with its newest, not each on its own -/// clock; the render pipeline's clock will give every line its own. -fn nowMs() i64 { - var ts: std.c.timespec = undefined; - if (std.c.clock_gettime(.MONOTONIC, &ts) != 0) return 0; - return @as(i64, ts.sec) * 1000 + @divTrunc(@as(i64, ts.nsec), 1_000_000); -} - -pub fn expireUnattended(p: *Pardes) void { - if (!p.unattended) return; - // The clock as the session that recorded read it (core/tape.zig). - const now = p.tape.value(.clock, nowMs, .{}); - 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 = .{}; - pane.msg_older_len = 0; - p.needs_frame = true; - } -} - -/// 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; + for (text[0..n], row[0..n]) |c, *cell| cell.* = if (c < 0x20 or c == 0x7f) ' ' else c; + const line = row[0..n]; + const now = p.clock.now_ns; + // Progress from the same cause is updated, and is the newest said. + if (kind == .progress) for (m.live[0..m.live_len], 0..) |*s, i| { + if (s.kind != .progress or s.pane != serial or !std.mem.eql(u8, s.src.slice(), src)) continue; + const kept = s.*; + m.remove(i); + const last = &m.live[m.live_len]; + m.live_len += 1; + last.* = kept; + last.text.set(line); + last.t = now; + return last; }; - 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 = .{}; + if (m.live_len > 0) { + // The NEWEST wording wins, so it carries the latest clock. + const last = &m.live[m.live_len - 1]; + if (last.kind == kind and last.pane == serial and std.mem.eql(u8, last.src.slice(), src) and + std.mem.eql(u8, Message.body(last.text.slice()), Message.body(line))) + { + last.n +|= 1; + last.t = now; + last.text.set(line); + return last; + } } - var i: usize = 0; - while (i < pane.msg_older_len) { - if (dismissLine(p, &pane.msg_older[i].life)) pane.removeOlderMessage(i) else i += 1; + if (kind != .progress) { + var i: usize = 0; + while (i < m.live_len) { + const old = m.live[i].kind; + if (old == .echo or old == .notice or (kind == .@"error" and old == .@"error")) m.remove(i) else i += 1; + } + } + if (m.live_len == max_live) { + var oldest: usize = 0; + while (oldest + 1 < m.live_len and m.live[oldest].kind == .question) oldest += 1; + m.remove(oldest); } + const s = &m.live[m.live_len]; + m.live_len += 1; + s.* = .{ .kind = kind, .pane = serial, .t = now }; + s.src.set(src); + s.text.set(line); + return s; } -/// Start one line's exit; true when it is gone at once (no linger). -fn dismissLine(p: *const Pardes, life: *Pane.MessageLife) bool { - if (life.phase == .lingering) return false; - if (p.settings.message_linger_ms == 0) return true; - life.* = .{ .phase = .lingering }; - return false; +fn remove(m: *Messages, i: usize) void { + std.mem.copyForwards(Said, m.live[i .. m.live_len - 1], m.live[i + 1 .. m.live_len]); + m.live_len -= 1; } -/// One frame of every lingering message line. The one that goes owes a -/// frame: a tick asks for none itself. -pub fn advanceMessages(p: *Pardes) void { - for (p.panes) |slot| { - const pane = slot orelse continue; - if (pane.msg_len > 0 and pane.msg_life.phase != .shown) { - p.needs_frame = true; - if (advanceLine(p, &pane.msg_life)) { - pane.msg_len = 0; - pane.msg_life = .{}; - } - } - var i: usize = 0; - while (i < pane.msg_older_len) { - if (pane.msg_older[i].life.phase != .shown) p.needs_frame = true; - if (advanceLine(p, &pane.msg_older[i].life)) pane.removeOlderMessage(i) else i += 1; - } +/// Retire every live message of `kinds` (Esc: the warnings and errors); +/// how many went. +pub fn retire(m: *Messages, kinds: []const Kind) usize { + var gone: usize = 0; + var i: usize = 0; + while (i < m.live_len) { + if (std.mem.indexOfScalar(Kind, kinds, m.live[i].kind) != null) { + m.remove(i); + gone += 1; + } else i += 1; } + return gone; } -/// One frame of one line's life; true once it has gone. -fn advanceLine(p: *const Pardes, life: *Pane.MessageLife) bool { - if (life.phase == .shown) return false; - life.frame +|= 1; - return life.frame >= messageFrames(p.settings.message_linger_ms); +/// The message the notice row leads with: the highest-ranked, the newest +/// within a rank; progress never. +pub fn headline(m: *const Messages) ?*const Said { + var best: ?*const Said = null; + for (m.live[0..m.live_len]) |*s| { + if (s.kind == .progress) continue; + if (best == null or s.kind.rank() >= best.?.kind.rank()) best = s; + } + return best; } -/// Move every lingering message line `frames` along its linger at once: -/// how `advance` jumps a wait instead of stepping it frame by frame. -pub fn holdMessages(p: *Pardes, frames: u64) void { - const n: u16 = @intCast(@min(frames, std.math.maxInt(u16))); - for (p.panes) |slot| { - const pane = slot orelse continue; - if (pane.msg_len > 0 and pane.msg_life.phase == .lingering) pane.msg_life.frame +|= n; - for (pane.msg_older[0..pane.msg_older_len]) |*line| { - if (line.life.phase == .lingering) line.life.frame +|= n; - } +/// The words the newest live message said of `pane` has, "" for none: +/// what its band shows, and what a write that failed on it answers. +pub fn saidBy(m: *const Messages, pane: *const Pane) []const u8 { + var i = m.live_len; + while (i > 0) { + i -= 1; + if (m.live[i].pane == pane.serial) return m.live[i].text.slice(); } + return ""; } -/// Frames until this pane's message lines next change: the rest of a -/// linger, null when every line just shows. -pub fn messageWake(p: *const Pardes, pane: *const Pane) ?u64 { +/// When the next live message dims, on the core's clock; null for none. +pub fn dimDue(p: *const Pardes) ?u64 { + const m = &p.messages; + if (p.settings.message_linger_ms == 0) return null; var soonest: ?u64 = null; - const linger = messageFrames(p.settings.message_linger_ms); - for (0..@as(usize, pane.msg_older_len) + 1) |i| { - const life = if (i < pane.msg_older_len) pane.msg_older[i].life else if (pane.msg_len > 0) pane.msg_life else continue; - if (life.phase == .shown) continue; - const frames: u64 = @max(1, linger -| life.frame); - soonest = if (soonest) |n| @min(n, frames) else frames; + for (m.live[0..m.live_len]) |*s| { + const bright: u64 = switch (s.kind) { + .echo, .notice => p.settings.message_linger_ms, + .warn => 2 * @as(u64, p.settings.message_linger_ms), + else => continue, + }; + const due = s.t + bright * std.time.ns_per_ms; + if (due <= p.clock.stepped_ns) continue; + soonest = if (soonest) |first| @min(first, due) else due; } return soonest; } -/// Frames a message timing lasts; at least one. -pub fn messageFrames(ms: u16) u16 { - return @intCast(@max(1, (@as(u32, ms) + pardes.frame_ms - 1) / pardes.frame_ms)); -} - /// What notice band `i` says. The grid pass and the band layers both /// read it here, so a terminal and a pixel shell show the same line. pub fn noticeText(p: *const Pardes, pane: *const Pane, i: usize, leader_buf: *[16]u8) []const u8 { return switch (pane.notices.kinds[i]) { - .message => pane.msg[0..pane.msg_len], - .older => pane.msg_older[pane.notices.index[i]].slice(), + .message => p.messages.saidBy(pane), .leader => leaderText(p, leader_buf), .prompt => pane.promptText() orelse "", }; } -fn logMessage(p: *Pardes, id: usize, text: []const u8) void { +fn logMessage(p: *Pardes, id: usize, kind: Kind, text: []const u8) void { if (text.len == 0) return; const serial: u32 = if (p.fs.session_write) 0 else if (id < MAX_PANES) if (p.panes[id]) |pane| pane.serial else 0 else 0; const kept = text[0..@min(text.len, LoggedMessage.cap)]; @@ -349,6 +441,7 @@ fn logMessage(p: *Pardes, id: usize, text: []const u8) void { @memcpy(slot.text[0..slot.len], kept); slot.serial = serial; slot.repeats = 1; + slot.kind = kind; p.messages.head = (p.messages.head + 1) % limits.message_log; p.messages.len = @min(p.messages.len + 1, limits.message_log); } @@ -478,9 +571,9 @@ pub fn reportFailure(p: *Pardes, id: usize, text: []const u8) void { if (failing_write) { p.fs.unlogged = true; defer p.fs.unlogged = false; - return setMessage(p, .at(id), text); + return say(p, .@"error", id, text); } - setMessage(p, .at(id), text); + say(p, .@"error", id, text); } /// The one place that decides which transient lines a pane is showing and @@ -510,10 +603,8 @@ pub fn collectNotices(p: *Pardes, pane: *Pane, r: Rect, id: usize) void { pub fn bands(p: *const Pardes, v: *const Pardes.View, pane: *const Pane, tag_rows: u16, r: Rect, id: usize) Pane.Notices { var n: Pane.Notices = .{}; if (r.w <= config.GUTTER or r.h <= tag_rows) return n; - // Oldest message line on top, so lines already up do not move when a - // new one lands under them; when rows run out the oldest go first. - for (pane.msg_older[0..pane.msg_older_len], 0..) |line, i| n.pushAt(.older, @intCast(i), line.slot); - if (pane.msg_len > 0) n.pushAt(.message, 0, pane.msg_slot); + // The newest message said of it on top. + if (p.messages.saidBy(pane).len > 0) n.push(.message); if (id == v.active and v.prefix == .leader) n.push(.leader); // Del's question shows once its delay is up: answered before that, it // was never there. @@ -525,28 +616,18 @@ pub fn bands(p: *const Pardes, v: *const Pardes.View, pane: *const Pane, tag_row // into blind. A two-row pane spends its only body row on one notice, // which is what the single shared row used to do anyway. const room: u8 = @intCast(@min(@as(u16, Pane.Notices.max), r.h - tag_rows)); - if (n.span() <= room) return n; - // Too short for the gaps: close them up in screen order, and if even - // that does not fit, the top bands go. - var i: usize = 1; - while (i < n.len) : (i += 1) { - var j = i; - while (j > 0 and n.row[j - 1] > n.row[j]) : (j -= 1) { - std.mem.swap(Pane.Notices.Kind, &n.kinds[j - 1], &n.kinds[j]); - std.mem.swap(u8, &n.index[j - 1], &n.index[j]); - std.mem.swap(u8, &n.row[j - 1], &n.row[j]); - } - } - const drop = n.len -| room; - for (0..n.len - drop) |k| { + if (n.len <= room) return n; + // Too short for them all: the top bands go. + const drop = n.len - room; + for (0..room) |k| { n.kinds[k] = n.kinds[k + drop]; - n.index[k] = n.index[k + drop]; n.row[k] = @intCast(k); } - n.len -= @intCast(drop); + n.len = room; return n; } + test "errors are said in words, and a ZON failure names its line" { var buf: [128]u8 = undefined; try std.testing.expectEqualStrings("file not found", errorWords(error.FileNotFound, &buf)); @@ -608,177 +689,84 @@ test "the message log keeps what the row forgets, and collapses repeats" { try std.testing.expectEqualStrings(want_last, p.messages.at(limits.message_log - 1).?.slice()); } -test "Msg writes the transient row by hand, bare or with text, and input ends it" { +test "Msg says a notice by hand, bare or with text, and the next message retires it" { if (pardes.Term.ops == null) return error.SkipZigTest; // the classic boot's three shells const p = try Pardes.init(std.testing.allocator, .{ .shells = 3, .cols = 100, .rows = 30 }); defer p.deinit(); while (p.nextEffect()) |_| {} - const row = struct { - fn of(pp: *Pardes, i: usize) []const u8 { - const pane = pp.panes[i].?; - return pane.msg[0..pane.msg_len]; - } - }.of; - // the whole tail, spaces and all: the row is a sentence, not a word try std.testing.expect(p.executeBuiltinLine(2, "Msg saved /etc/hosts")); - try std.testing.expectEqualStrings("saved /etc/hosts", row(p, 2)); - // ...on the pane that ran it, and nowhere else - try std.testing.expectEqualStrings("", row(p, 0)); - + try std.testing.expectEqualStrings("saved /etc/hosts", p.messages.saidBy(p.panes[2].?)); + // ...of the pane that ran it, its cause that pane's address + try std.testing.expectEqualStrings("", p.messages.saidBy(p.panes[0].?)); + var want: [16]u8 = undefined; + try std.testing.expectEqualStrings(try std.fmt.bufPrint(&want, "@p{d}", .{p.panes[2].?.serial}), p.messages.headline().?.src.slice()); // Bare, it reports ITSELF through reportError — the `<operation>: <error in words>` - // every failed save and refused Look arrives in. + // every failed save and refused Look arrives in: an error. try std.testing.expect(p.executeBuiltinLine(2, "Msg")); - try std.testing.expectEqualStrings("Msg: no message", row(p, 2)); - - // Input starts its exit: it lingers, and is gone. - p.update(.{ .key = .{ .cp = Key.escape } }); - try std.testing.expectEqualStrings("Msg: no message", row(p, 2)); - for (0..200) |_| p.update(.tick); - try std.testing.expectEqualStrings("", row(p, 2)); - // ...and with no linger it is as old as your last input. - try std.testing.expect(p.executeBuiltinLine(2, "MessageLinger 0")); - try std.testing.expect(p.executeBuiltinLine(2, "Msg gone")); + try std.testing.expectEqualStrings("Msg: no message", p.messages.saidBy(p.panes[2].?)); + try std.testing.expectEqual(Kind.@"error", p.messages.headline().?.kind); + // Input takes nothing away; the next message does what the notice + // was, and the error stays until Esc. p.update(.{ .key = .{ .cp = 'h' } }); - try std.testing.expectEqualStrings("", row(p, 2)); + for (0..200) |_| p.update(.tick); + try std.testing.expectEqualStrings("Msg: no message", p.messages.saidBy(p.panes[2].?)); + try std.testing.expect(p.executeBuiltinLine(2, "Msg next")); + try std.testing.expectEqual(@as(u8, 2), p.messages.live_len); + try std.testing.expectEqual(Kind.@"error", p.messages.headline().?.kind); - // Longer than the row's buffer is CUT, never refused and never overrun: + // Longer than a message's room is CUT, never refused and never overrun: // this word is the only way to reach that boundary without a 300-byte path. var long: [600]u8 = @splat('x'); var line: [608]u8 = undefined; const cmd = try std.fmt.bufPrint(&line, "Msg {s}", .{&long}); try std.testing.expect(p.executeBuiltinLine(2, cmd)); - try std.testing.expectEqual(p.panes[2].?.msg.len, row(p, 2).len); + try std.testing.expectEqual(@as(usize, 256), p.messages.saidBy(p.panes[2].?).len); } -test "with no frontend attached a message goes once it has lingered, on the clock" { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); +test "an echo or a notice retires those before it, an error the error before it, a repeat counts and progress runs in place" { + const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - const pane = p.panes[p.view().active].?; - p.setMessage(.at(p.view().active), "said"); - p.setMessage(.at(p.view().active), "said again"); - // Attached: it waits for input, however long. - pane.msg_said_ms -= 60_000; - p.update(.tick); - try std.testing.expect(pane.msg_len > 0); - // Detached with nobody attached: past its linger it is gone, and the - // line above it with it. - p.unattended = true; - // A read served meanwhile changes nothing; the session's step after its - // wait expires, not the host (whose call no replay makes). - _ = p.serveFs(.{ .tag = 1, .op = .read, .node = @backingInt(ctlfs.TopFile.index), .size = 64 }); - try std.testing.expect(pane.msg_len > 0); - try p.pump(.{}); - try std.testing.expectEqual(@as(u16, 0), pane.msg_len); - try std.testing.expectEqual(@as(u8, 0), pane.msg_older_len); - // A fresh one stays until its linger is up. - p.setMessage(.at(p.view().active), "fresh"); - p.update(.tick); - try std.testing.expect(pane.msg_len > 0); -} - -test "a message lingers past the input that dismisses it, and goes" { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); - defer p.deinit(); - while (p.nextEffect()) |_| {} - const pane = p.panes[p.view().active].?; - try std.testing.expect(p.executeBuiltinLine(p.view().active, "MessageLinger 160")); - try std.testing.expect(p.executeBuiltinLine(p.view().active, "Msg hello")); - // Shown at once, until input; the same line again stays shown. - try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); - try std.testing.expect(!p.animationActive()); - for (0..100) |_| p.update(.tick); - try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); - try std.testing.expect(p.executeBuiltinLine(p.view().active, "Msg hello")); - try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); - // Input (a key that announces nothing): 160 ms of lingering (ten frames), unaffected by more input... - p.update(.{ .key = .{ .cp = 'h' } }); - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); - for (0..9) |_| { - p.update(.tick); - p.update(.{ .key = .{ .cp = 'h' } }); + _ = try p.setTestFile("text\n"); + const id = p.view().active; + const m = &p.messages; + m.live_len = 0; + say(p, .notice, id, "first"); + say(p, .echo, id, "second"); + try std.testing.expectEqual(@as(u8, 1), m.live_len); + try std.testing.expectEqualStrings("second", m.headline().?.text.slice()); + say(p, .@"error", id, "broke"); + say(p, .warn, id, "careful"); + // The echo went with the error; the warning stands beside it. + try std.testing.expectEqual(@as(u8, 2), m.live_len); + try std.testing.expectEqual(Kind.@"error", m.headline().?.kind); + say(p, .@"error", id, "broke again"); + try std.testing.expectEqual(@as(u8, 2), m.live_len); + try std.testing.expectEqualStrings("broke again", m.headline().?.text.slice()); + // The same again right after itself: one message, counted, its newest + // wording (and clock) kept. + for (0..9) |_| say(p, .@"error", id, "broke again"); + try std.testing.expectEqual(@as(u8, 2), m.live_len); + try std.testing.expectEqual(@as(u16, 10), m.headline().?.n); + // Progress updates its line in place and retires nothing. + say(p, .progress, id, "Changes: jj 1/4"); + say(p, .progress, id, "Changes: jj 3/4"); + try std.testing.expectEqual(@as(u8, 3), m.live_len); + try std.testing.expectEqualStrings("Changes: jj 3/4", m.saidBy(p.panes[id].?)); + try std.testing.expectEqual(Kind.@"error", m.headline().?.kind); + // Esc in normal mode takes the warnings and errors. + p.update(.{ .key = .{ .cp = Key.escape } }); + try std.testing.expectEqual(@as(u8, 1), m.live_len); + try std.testing.expectEqual(Kind.progress, m.live[0].kind); + try std.testing.expect(m.headline() == null); + // Past the room, the oldest that is no question goes. + m.live_len = 0; + for (0..max_live + 3) |i| { + var buf: [16]u8 = undefined; + say(p, .warn, id, std.fmt.bufPrint(&buf, "w{d}", .{i}) catch unreachable); } - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); - // ...then it is gone, and the tick that clears it owes the frame that - // shows it gone. - p.needs_frame = false; - p.update(.tick); - try std.testing.expectEqual(@as(u16, 0), pane.msg_len); - try std.testing.expect(p.needs_frame); - try std.testing.expect(!p.animationActive()); - // Shown again while lingering: fresh, so it stays; a status update to a - // line on screen swaps its text in place. - try std.testing.expect(p.executeBuiltinLine(p.view().active, "Msg again")); - p.update(.{ .key = .{ .cp = 'h' } }); - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); - try std.testing.expect(p.executeBuiltinLine(p.view().active, "Msg again")); - try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); - setStatus(p, .at(p.view().active), "progress 50%"); - try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); - try std.testing.expectEqualStrings("progress 50%", pane.msg[0..pane.msg_len]); - try std.testing.expectEqual(@as(u8, 0), pane.msg_older_len); -} - -test "messages stack, oldest on top, each on its own timing" { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); - defer p.deinit(); - while (p.nextEffect()) |_| {} - const pane = p.panes[p.view().active].?; - try std.testing.expect(p.executeBuiltinLine(p.view().active, "Verbose off")); - try std.testing.expect(p.executeBuiltinLine(p.view().active, "MessageLinger 160")); - // `Verbose off` announced itself before it took effect. - pane.msg_len = 0; - pane.msg_life = .{}; - setMessage(p, .at(p.view().active), "first"); - try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); - // A second message stacks under the first instead of replacing it. - setMessage(p, .at(p.view().active), "second"); - try std.testing.expectEqual(@as(u8, 1), pane.msg_older_len); - try std.testing.expectEqualStrings("first", pane.msg_older[0].slice()); - try std.testing.expectEqualStrings("second", pane.msg[0..pane.msg_len]); - collectNotices(p, pane, p.view().rects[p.view().active], p.view().active); - try std.testing.expectEqual(Pane.Notices.Kind.older, pane.notices.kinds[0]); - try std.testing.expectEqual(Pane.Notices.Kind.message, pane.notices.kinds[1]); - // One key dismisses both, each on its own clock: a line already - // lingering keeps its timing. - p.update(.{ .key = .{ .cp = 'h' } }); - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_older[0].life.phase); - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); - p.update(.tick); - setMessage(p, .at(p.view().active), "third"); - try std.testing.expectEqual(@as(u8, 2), pane.msg_older_len); - p.update(.{ .key = .{ .cp = 'h' } }); - const linger = messageFrames(p.settings.message_linger_ms); - for (0..linger - 1) |_| p.update(.tick); - // The first two are gone; the third, a frame later, still lingers. - try std.testing.expectEqual(@as(u8, 0), pane.msg_older_len); - try std.testing.expectEqualStrings("third", pane.msg[0..pane.msg_len]); - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); - p.update(.tick); - try std.testing.expectEqual(@as(u16, 0), pane.msg_len); - try std.testing.expect(!p.animationActive()); - // A status ticking in place does not pile up. - setStatus(p, .at(p.view().active), "lsp 10%"); - setStatus(p, .at(p.view().active), "lsp 20%"); - try std.testing.expectEqual(@as(u8, 0), pane.msg_older_len); - // Lines keep their rows: when the top one leaves, the one under it does - // not move up, and the next message fills the gap instead. - setMessage(p, .at(p.view().active), "top"); - setMessage(p, .at(p.view().active), "under"); - try std.testing.expectEqual(@as(u8, 0), pane.msg_older[0].slot); - try std.testing.expectEqual(@as(u8, 1), pane.msg_slot); - pane.removeOlderMessage(0); - collectNotices(p, pane, p.view().rects[p.view().active], p.view().active); - try std.testing.expectEqual(@as(u8, 1), pane.notices.row[0]); - try std.testing.expectEqual(@as(u8, 2), pane.notices.span()); - setMessage(p, .at(p.view().active), "fills"); - try std.testing.expectEqual(@as(u8, 0), pane.msg_slot); - try std.testing.expectEqual(@as(u8, 1), pane.msg_older[0].slot); - // The stack keeps the newest few. - for ([_][]const u8{ "a", "b", "c", "d", "e" }) |text| setMessage(p, .at(p.view().active), text); - try std.testing.expectEqual(@as(u8, Pane.message_stack), pane.msg_older_len); - try std.testing.expectEqualStrings("b", pane.msg_older[0].slice()); - try std.testing.expectEqualStrings("e", pane.msg[0..pane.msg_len]); + try std.testing.expectEqual(@as(u8, max_live), m.live_len); + try std.testing.expectEqualStrings("w3", m.live[0].text.slice()); } test "a builtin announces itself on the message row, and Verbose silences it" { @@ -792,11 +780,11 @@ test "a builtin announces itself on the message row, and Verbose silences it" { // Wrap, not Collapse: a builtin that folds its own pane away leaves no row // for its announcement, which is correct and not what this is testing. try std.testing.expect(p.executeBuiltinLine(p.view().active, "Wrap")); - try std.testing.expectEqualStrings("Wrap", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("Wrap", p.messages.saidBy(pane)); // A value it does not take is said, in place of the announcement. const wrapped = p.settings.wrap; try std.testing.expect(p.executeBuiltinLine(p.view().active, "Wrap maybe")); - try std.testing.expectEqualStrings("Wrap: takes on, off", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("Wrap: takes on, off", p.messages.saidBy(pane)); try std.testing.expectEqual(wrapped, p.settings.wrap); // The notice list is what the paint pass reads, so the announcement has to @@ -825,12 +813,12 @@ test "a builtin announces itself on the message row, and Verbose silences it" { // Msg owns the row itself, so it does not announce over its own text. try std.testing.expect(p.executeBuiltinLine(p.view().active, "Msg hello")); - try std.testing.expectEqualStrings("hello", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("hello", p.messages.saidBy(pane)); - pane.msg_len = 0; + p.messages.live_len = 0; p.settings.verbose = false; try std.testing.expect(p.executeBuiltinLine(p.view().active, "Wrap")); - try std.testing.expectEqual(@as(u16, 0), pane.msg_len); + try std.testing.expectEqual(@as(usize, 0), p.messages.saidBy(pane).len); } test "notices stack over the body's top rows without moving them" { @@ -874,47 +862,34 @@ test "notices stack over the body's top rows without moving them" { // Gone with the notices: no stale chip left behind. p.view().prefix = .none; - pane.msg_len = 0; + p.messages.live_len = 0; _ = frame.reset(.retain_capacity); _ = try p.render(frame.allocator()); for (p.surface.tagLayers()) |*layer| try std.testing.expect(layer.rows == 0 or layer.kind != .notice); } -test "an idle core wants no wake and a lingering message sleeps to its linger's end" { +test "an idle core wants no wake, and a message wakes it once, when it dims" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); while (p.nextEffect()) |_| {} - const frame = pardes.frame_ns; p.advance(1_000_000); + p.messages.live_len = 0; try std.testing.expectEqual(@as(?u64, null), p.nextWake()); - const pane = p.panes[p.view().active].?; - // Shown, a message asks for no wake. + try std.testing.expect(p.executeBuiltinLine(p.view().active, "MessageLinger 160")); try std.testing.expect(p.executeBuiltinLine(p.view().active, "Msg hello")); - try std.testing.expectEqual(Pane.MessagePhase.shown, pane.msg_life.phase); + const said = p.messages.headline().?; + try std.testing.expect(!said.faded(p.clock.now_ns, p.settings.message_linger_ms)); + // The core sleeps to its dimming, not a frame at a time. + const frame = pardes.frame_ns; + const due = said.t + 160 * std.time.ns_per_ms; + const woken = p.nextWake().?; + try std.testing.expect(woken >= due and woken < due + frame); + p.advance(woken); + try std.testing.expect(said.faded(p.clock.now_ns, p.settings.message_linger_ms)); try std.testing.expectEqual(@as(?u64, null), p.nextWake()); - // A key starts the 800 ms linger: the core sleeps to its end, not a - // frame at a time, and the frames it jumps draw nothing. - p.update(.{ .key = .{ .cp = 'x' } }); - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); - const linger = messageFrames(p.settings.message_linger_ms); - const due = p.clock.stepped_ns + linger * frame; - try std.testing.expectEqual(@as(?u64, due), p.nextWake()); - p.needs_frame = false; - p.advance(due - frame); - try std.testing.expectEqual(@as(?u64, due), p.nextWake()); - try std.testing.expectEqual(Pane.MessagePhase.lingering, pane.msg_life.phase); - p.advance(due); - try std.testing.expectEqual(@as(usize, 0), pane.msg_len); + // A warning is bright twice as long; with no linger nothing wakes. + try std.testing.expect(p.executeBuiltinLine(p.view().active, "MessageLinger 0")); + say(p, .warn, p.view().active, "careful"); try std.testing.expectEqual(@as(?u64, null), p.nextWake()); - - // A long linger ends when it says, jumped in one step, not stretched by - // the cap on catching up with moving frames. - try std.testing.expect(p.executeBuiltinLine(p.view().active, "MessageLinger 5000")); - try std.testing.expect(p.executeBuiltinLine(p.view().active, "Msg again")); - p.update(.{ .key = .{ .cp = 'x' } }); - const long_due = p.clock.stepped_ns + messageFrames(5000) * frame; - try std.testing.expectEqual(@as(?u64, long_due), p.nextWake()); - p.advance(long_due); - try std.testing.expectEqual(@as(usize, 0), pane.msg_len); } diff --git a/core/Pipe.zig b/core/Pipe.zig index 012ce689..000d1f74 100644 --- a/core/Pipe.zig +++ b/core/Pipe.zig @@ -483,7 +483,7 @@ test "a pipe's output past its cap leaves the text as it was, and says so" { const outputs: []const []const u8 = &.{ "AA", big }; p.update(.{ .pipe_resp = .{ .id = id, .success = true, .outputs = outputs } }); try std.testing.expectEqualSlices(u8, "aa bb cc\n", pane.file.?.content); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "past") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "past") != null); } test "the four shell behaviours put their output where helix puts it" { diff --git a/core/Plumb.zig b/core/Plumb.zig index e1b09e69..402752a3 100644 --- a/core/Plumb.zig +++ b/core/Plumb.zig @@ -1345,7 +1345,7 @@ test "plumb: dispose: no rule and no dst, a start, the web port, a port no rule // A start of a builtin runs it in place. try testing.expect(send(p, null, .{ .type = "msg", .data = "hello" }, null) == .done); const pane = p.panes[p.view().active].?; - try testing.expectEqualStrings("hello", pane.msg[0..pane.msg_len]); + try testing.expectEqualStrings("hello", p.messages.saidBy(pane)); try testing.expectEqualStrings(e_client, send(p, null, .{ .type = "client" }, null).refused); try testing.expectEqualStrings(e_no_start, send(p, null, .{ .type = "none" }, null).refused); try testing.expectEqualStrings(e_no_start, send(p, null, .{ .dst = "nobody", .type = "x" }, null).refused); @@ -1499,12 +1499,12 @@ test "plumb: the Plumb word opens the plumbing file, include basic until one is // A rule after the word is refused, in words. try testing.expect(p.executeBuiltinLine(0, "Plumb suffix .svg to image")); const first = p.panes[0].?; - try testing.expectEqualStrings(e_word, first.msg[0..first.msg_len]); + try testing.expectEqualStrings(e_word, p.messages.saidBy(first)); // Saved: its rules, or why not, the rules as they were. saved(p, 0, path, "type is text\ndata matches 'x.*'\nplumb to web\n"); try testing.expectEqualStrings("type\tis\ttext\ndata\tmatches\t'x.*'\nplumb\tto\tweb\n\n", inForce(p)); saved(p, 0, path, "type is text\ndata isnt x\nplumb to web\n"); - try testing.expectEqualStrings("plumbing:2: unknown verb isnt", first.msg[0..first.msg_len]); + try testing.expectEqualStrings("plumbing:2: unknown verb isnt", p.messages.saidBy(first)); try testing.expectEqualStrings("type\tis\ttext\ndata\tmatches\t'x.*'\nplumb\tto\tweb\n\n", inForce(p)); // Another file saved is no plumbing. saved(p, 0, "/elsewhere/plumbing", "type is text\nplumb to edit\n"); diff --git a/core/Query.zig b/core/Query.zig index feebb6cd..b272da4b 100644 --- a/core/Query.zig +++ b/core/Query.zig @@ -2481,7 +2481,7 @@ test "a language server's list: one answer lands with no pane, several open the p.lspRequest(0, .diagnostics, ""); p.update(.{ .lsp_resp = .{ .id = p.lsp_ask.wait.?.id, .rows = "" } }); try std.testing.expectEqual(@as(usize, 1), npanes(p)); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "none") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "none") != null); // Several: the list open, the keyboard in it in normal mode on the // current row, which the text shows; line 1 as text. pane.body.cur_row = 0; diff --git a/core/Term.zig b/core/Term.zig index f0329852..a83bf927 100644 --- a/core/Term.zig +++ b/core/Term.zig @@ -559,10 +559,10 @@ test "a core without a terminal: Term refuses in words, and no line is typed at try std.testing.expectError(error.NoTerminal, p.newShell(p.freeSlot().?, "")); try std.testing.expect(p.executeBuiltinLine(0, "Term")); const pane = p.panes[0].?; - try std.testing.expectEqualStrings("Term: " ++ none, pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("Term: " ++ none, p.messages.saidBy(pane)); // A line no shell can take runs in a command pane, a terminal: refused. try std.testing.expectEqual(null, pardes.exec.execute(p, 0, "make")); - try std.testing.expectEqualStrings("exec: " ++ none, pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("exec: " ++ none, p.messages.saidBy(pane)); for (p.panes, 0..) |slot, id| if (slot) |_| try std.testing.expect(!pardes.exec.takesCommandLine(p, id)); } diff --git a/core/builtins.zig b/core/builtins.zig index a236b0d6..0c643a18 100644 --- a/core/builtins.zig +++ b/core/builtins.zig @@ -1248,7 +1248,7 @@ pub const Del = struct { var rec: [32]u8 = undefined; pardes.ctlfs.events.notePath(c.p, "ask", std.fmt.bufPrint(&rec, "{d} del k j", .{c.pane.serial}) catch unreachable); // a u32 fits 32 // The question says Del already. - if (c.pane.msg_announcement) c.pane.msg_len = 0; + _ = c.p.messages.retire(&.{.echo}); return; } c.p.removePane(c.id, to) catch |err| return c.p.reportError(.at(c.id), "close", err); @@ -2363,7 +2363,7 @@ test "Exit over a ctl write or a click names every pane it asks about, a second try std.testing.expect(std.mem.endsWith(u8, unsavedList(p), "\nExit again to discard\n")); var noticed = false; for (p.panes) |slot| if (slot) |pane| { - noticed = noticed or std.mem.eql(u8, pane.msg[0..pane.msg_len], "2 unsaved panes \u{2014} Exit again to discard"); + noticed = noticed or std.mem.eql(u8, p.messages.saidBy(pane), "2 unsaved panes \u{2014} Exit again to discard"); }; try std.testing.expect(noticed); // Edited since: only that one is named again (acme's rule). @@ -2463,7 +2463,7 @@ test "Kill stops the commands pardes typed, bare all and by name those that matc p.host = .{ .vtable = &killed.vtable }; // Nothing running: nothing to stop, and never the shell; said. try std.testing.expectEqual(@as(usize, 0), killed.count(p, "Kill")); - try std.testing.expectEqualStrings("Kill: nothing running", p.panes[term].?.msg[0..p.panes[term].?.msg_len]); + try std.testing.expectEqualStrings("Kill: nothing running", p.messages.saidBy(p.panes[term].?)); _ = exec.execute(p, term, "make -j8"); while (p.nextEffect()) |_| {} // Typed but not started yet (no C mark): not running. 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); diff --git a/core/config.zig b/core/config.zig index e9225c53..9673da73 100644 --- a/core/config.zig +++ b/core/config.zig @@ -633,8 +633,9 @@ pub const Settings = struct { /// A jump of the cursor leaves a short trail that fades: a setting /// alone, each frontend draws it (jump_trail.zig). jump_trail: bool = false, - /// How long a message stays after the key or click that dismisses it. - message_linger_ms: u16 = 800, + /// How long an echo or a notice stays bright before it dims (a warning + /// twice as long): Messages.Said.faded. + message_linger_ms: u16 = 4000, /// Where Dump writes and a relative Restore looks; empty is the default /// ($XDG_DATA_HOME/pardes, else ~/.local/share/pardes). dump_dir: Text(limits.host_path_cap) = .{}, @@ -798,7 +799,7 @@ pub const Settings = struct { .{ .word = "GripWidth", .action = .grip_width, .doc = "The grip and scrollbar width, as a percent of the theme's rail." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, .{ .word = "Pet", .action = .{ .choice = .pet }, .doc = "The window's companion in the workspace tag's blank space: off, cat or frog." }, - .{ .word = "MessageLinger", .action = .message_linger, .doc = "How long, in milliseconds, a message stays after what dismisses it." }, + .{ .word = "MessageLinger", .action = .message_linger, .doc = "How long, in milliseconds, an echo or a notice stays bright before it dims; a warning twice as long." }, .{ .word = "DumpDir", .action = .dump_dir, .doc = "The directory of the state file, where Dump writes and Recent is kept. A relative Restore name is looked for there too; bare, the default." }, .{ .word = "Theme", .action = .theme, .doc = "Switch to the theme named: `Theme atelier`. Themes lists them, NextColor steps through them." }, .{ .word = "Shell", .action = .shell, .doc = "The shell new terminals run: `Shell /bin/zsh`; bare, $SHELL if it is executable, else /bin/sh." }, diff --git a/core/draw.zig b/core/draw.zig index ff76aa75..c3c80934 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -230,9 +230,7 @@ fn joinNotice(p: *Pardes, s: *Surface, arena: std.mem.Allocator, region: Region) var leader_buf: [16]u8 = undefined; const text = Messages.noticeText(p, pane, i, &leader_buf); const bg = chrome.tag_bg; - // Where an exec was sent to a REPL reads in the tag's name tint, set - // apart from what the editor says. - const fg = if (kind == .message and pane.msg_sent) chrome.tag_name_fg else chrome.tag_fg; + const fg = chrome.tag_fg; // Nothing to say, or too narrow for a layer: a blank chip on the grid. if (text.len == 0 or r.w <= TAG_TEXT_INSET) { s.fill(region.rect.x, region.rect.y, chip, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); @@ -1473,7 +1471,7 @@ fn apart(a: *const Pardes, b: *const Pardes) bool { var pdb: [pane_names.len]u64 = undefined; _ = pardes.walk.fieldDigests(Pane, x, &pda); _ = pardes.walk.fieldDigests(Pane, y, &pdb); - for (pane_names, pda, pdb) |name, u, v| if (u != v and !std.mem.eql(u8, name, "msg_said_ms") and !std.mem.eql(u8, name, "cwd")) { + for (pane_names, pda, pdb) |name, u, v| if (u != v and !std.mem.eql(u8, name, "cwd")) { if (std.mem.eql(u8, name, "file")) if (x.file) |*fx| if (y.file) |*fy| { const file_names = comptime pardes.walk.fieldNames(panes.File.State); var fda: [file_names.len]u64 = undefined; diff --git a/core/edit.zig b/core/edit.zig index 3e57927a..ca9cbd91 100644 --- a/core/edit.zig +++ b/core/edit.zig @@ -2308,7 +2308,7 @@ test "insert on a terminal's text says it edits a copy the program's next drawin pane.body.mode = .normal; p.update(.{ .key = .{ .cp = 'i' } }); p.update(.{ .key = .{ .cp = 'x', .text = "x" } }); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "a copy of the terminal's text") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "a copy of the terminal's text") != null); } test "insert and normal modes edit complete Unicode graphemes" { @@ -2521,7 +2521,7 @@ test "a paste past the limit is cut at it, and says so" { try applyPaste(p, big); try std.testing.expect(pane.file.?.content.len <= limit); try std.testing.expect(pane.file.?.content.len > 0); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "paste cut") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "paste cut") != null); } test "typing and backspace through the line index keep the text and the index as a rebuild has them" { diff --git a/core/edit_cmd.zig b/core/edit_cmd.zig index aec97c63..d1b41834 100644 --- a/core/edit_cmd.zig +++ b/core/edit_cmd.zig @@ -300,7 +300,7 @@ fn answerHold(p: *Pardes, at: usize, failed: bool) void { if (!failed) return; const words = if (p.fs.said_at == p.fs.failures and p.fs.said_len > 0) p.fs.said[0..p.fs.said_len] - else if (p.panes[at]) |pane| pane.msg[0..pane.msg_len] else "Edit: failed"; + else if (p.panes[at]) |pane| p.messages.saidBy(pane) else "Edit: failed"; const kept = @import("Messages.zig").clip(words, h.said.len); @memcpy(h.said[0..kept.len], kept); h.said_len = @intCast(kept.len); diff --git a/core/exec.zig b/core/exec.zig index 2528805f..dbea2b2f 100644 --- a/core/exec.zig +++ b/core/exec.zig @@ -617,8 +617,7 @@ pub fn sendToRepl(p: *Pardes, from: usize, to: usize, text: []const u8) void { p.setMessage(.at(from), warn.print("Repl: {s} takes no bracketed paste; a blank line in a block ends it", .{id})); } var said: pardes.Kind.Buf(64) = .{}; - p.setMessage(.at(from), said.print("\u{2192} {s}", .{id})); - src.msg_sent = true; + pardes.Messages.say(p, .echo, from, said.print("\u{2192} {s}", .{id})); var rec: [96]u8 = undefined; pardes.ctlfs.events.notePath(p, "send", std.fmt.bufPrint(&rec, "{d} {d} {s}", .{ src.serial, dst.serial, id }) catch return); } @@ -974,15 +973,14 @@ pub fn runBuiltinFrom(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ? // No pane at all (the window Delcol emptied): a word runs all the same, // with a stand-in that is no pane (New, Newcol, Exit are what make sense). const pane = p.panes[id] orelse (if (builtins.registry.scope(b) == .session or panes.anyPane(p) == null) panes.standIn(p) orelse return else return); - // A builtin says its own name before it runs, so a tagline click is - // legible even when what it did is invisible. Whatever the builtin - // then says for itself replaces the announcement. It is the message - // row's only, never /log's: a msg record is something said. + // A builtin says its own name before it runs, an echo, so a tagline + // click is legible even when what it did is invisible. Whatever the + // builtin then says for itself retires it. It is the message row's + // only, never /log's: a msg record is something said. if (p.announce and p.settings.verbose and builtins.registry.announces(b)) { p.fs.unlogged = true; - p.setMessage(.at(id), @tagName(b)); + pardes.Messages.say(p, .echo, id, @tagName(b)); p.fs.unlogged = false; - pane.msg_announcement = true; } // A word for one kind of pane, on another: refused with why, not a // silent nothing (Palette on a file, Filter on a PDF). diff --git a/core/jj.zig b/core/jj.zig index c1d07662..b278f4ba 100644 --- a/core/jj.zig +++ b/core/jj.zig @@ -2534,7 +2534,7 @@ const Repo = struct { fn told(p: *Pardes, id: usize) []const u8 { const pane = p.panes[id].?; - return pane.msg[0..pane.msg_len]; + return p.messages.saidBy(pane); } test "At shows a file at a revision beside it, read-only, coloured as its file; a Look at path@rev:line goes to it; At in it turns it in place; jj's refusals are said" { @@ -3656,8 +3656,7 @@ test "the layer's lines are the pane's text, read-only: j and k go onto them, a // the path there opens it (no selection held: B2 in one runs it). // (The refusals' words, stacked in the notice band over the body's // first rows, gone.) - pane.msg_len = 0; - pane.msg_older_len = 0; + p.messages.live_len = 0; p.view().active = id; Lines.at(pane, 0, 0); p.sync(); diff --git a/core/keys.zig b/core/keys.zig index 9afb983b..5257a093 100644 --- a/core/keys.zig +++ b/core/keys.zig @@ -616,7 +616,7 @@ test "Del from a key asks which neighbour takes the rows; nothing else asks" { // A word that is not a side closes nothing. try std.testing.expect(p.executeBuiltinLine(again, "Del x")); - try std.testing.expectEqualStrings("Del: takes k, j or nothing", p.panes[again].?.msg[0..p.panes[again].?.msg_len]); + try std.testing.expectEqualStrings("Del: takes k, j or nothing", p.messages.saidBy(p.panes[again].?)); try std.testing.expect(p.panes[again] != null); // DelAbove is Del k, and a line that is not a key never asks. try std.testing.expect(p.executeBuiltinLine(again, "DelAbove")); diff --git a/core/look.zig b/core/look.zig index ee6debf9..8356dca8 100644 --- a/core/look.zig +++ b/core/look.zig @@ -2626,7 +2626,7 @@ test "Incl's directories find a name found nowhere else, <name> too; bare Incl l } // Bare, it lists them. try std.testing.expect(p.executeBuiltinLine(0, "Incl")); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "/inc") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "/inc") != null); // A dump keeps them. try pardes.dump.dumpState(p); const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); @@ -2764,7 +2764,7 @@ test "Look on a diff line is the look of the address it names, selected by hand: .active_path = try std.testing.allocator.dupe(u8, if (shown.file) |f| f.path else ""), .row = shown.body.cur_row, .missed = p.look_missed, - .msg = try std.testing.allocator.dupe(u8, pane.msg[0..pane.msg_len]), + .msg = try std.testing.allocator.dupe(u8, p.messages.saidBy(pane)), .panes = n, }; } @@ -2810,7 +2810,7 @@ test "Plumb: a look sends what it looks at, the rules written first: a rule's wo lookAt(p, 0, pic); try std.testing.expectEqual(@as(usize, 0), p.view().active); var said_buf: [4300]u8 = undefined; - try std.testing.expectEqualStrings(try std.fmt.bufPrint(&said_buf, "svg {s}", .{pic}), pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings(try std.fmt.bufPrint(&said_buf, "svg {s}", .{pic}), p.messages.saidBy(pane)); // A name open in a pane is focused, never sent. p.look_text = true; lookAt(p, 0, pic); @@ -2821,7 +2821,7 @@ test "Plumb: a look sends what it looks at, the rules written first: a rule's wo p.setMessage(.at(0), "before"); lookAt(p, 0, pic); try std.testing.expectEqual(opened, p.view().active); - try std.testing.expectEqualStrings("before", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("before", p.messages.saidBy(pane)); // With no web rule, a URL is a word Look searches for. p.view().active = 0; try std.testing.expect(Plumb.apply(p, false, "plumb/rules", "type is text\narg isfile $data\nplumb to edit\n") == null); diff --git a/core/lsp/Ask.zig b/core/lsp/Ask.zig index 29d36f0a..62248304 100644 --- a/core/lsp/Ask.zig +++ b/core/lsp/Ask.zig @@ -530,7 +530,7 @@ test "Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all r // A symbol the file does not hold is said, and nothing is asked. exec.runBuiltin(p, .Def, 0, "", "gamma"); try std.testing.expectError(error.NothingAsked, Asked.one(p, .definition)); - try std.testing.expectEqualStrings("Def: no gamma in this file", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("Def: no gamma in this file", p.messages.saidBy(pane)); } test "Callstack always opens and focuses its own pane, reusing it for another symbol" { @@ -580,7 +580,7 @@ test "Callers with one answer jumps to it and says where, in a msg" { const wait = p.lsp_ask.wait.?; p.update(.{ .lsp_resp = .{ .id = wait.id, .rows = "/test.txt:2:10 b\n" } }); try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); - try std.testing.expectEqualStrings("Callers: the one, /test.txt:2:10", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("Callers: the one, /test.txt:2:10", p.messages.saidBy(pane)); } test "a Rename the language server finds nothing for says so, and changes nothing" { @@ -591,7 +591,7 @@ test "a Rename the language server finds nothing for says so, and changes nothin p.lspRequest(p.view().active, .rename, "renamed"); const wait = p.lsp_ask.wait.?; p.update(.{ .lsp_resp = .{ .id = wait.id, .rows = "" } }); - try std.testing.expectEqualStrings("Rename: nothing here to rename", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("Rename: nothing here to rename", p.messages.saidBy(pane)); try std.testing.expectEqualStrings("const value=1;\n", pane.file.?.content); } diff --git a/core/mouse.zig b/core/mouse.zig index 14700995..ad76c313 100644 --- a/core/mouse.zig +++ b/core/mouse.zig @@ -1538,12 +1538,12 @@ test "a chorded exec an event reader holds is told with its argument, and writte const line = try std.fmt.bufPrint(&back, "M{s}", .{records[0][1..]}); try std.testing.expectEqual(ctlfs.Status.ok, th.call(p, .{ .tag = 3, .op = .write, .node = event, .handle = h, .data = line }).reply.status); const pane = p.panes[0].?; - try std.testing.expectEqualStrings("arg-text", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("arg-text", p.messages.saidBy(pane)); // All three records written back as read, in one write or in three: // the two after the first are its argument and where it came from, // never commands of their own. for ([_]bool{ true, false }) |together| { - pane.msg_len = 0; + p.messages.live_len = 0; var all: [256]u8 = undefined; var w = std.Io.Writer.fixed(&all); for (records) |r| try w.print("M{s}", .{r[1..]}); @@ -1553,7 +1553,7 @@ test "a chorded exec an event reader holds is told with its argument, and writte var one: [80]u8 = undefined; _ = th.call(p, .{ .tag = 6, .op = .write, .node = event, .handle = h, .data = try std.fmt.bufPrint(&one, "M{s}", .{r[1..]}) }); } - try std.testing.expectEqualStrings("arg-text", pane.msg[0..pane.msg_len]); + try std.testing.expectEqualStrings("arg-text", p.messages.saidBy(pane)); try std.testing.expect(!th.logHas(p, "run ")); } _ = th.call(p, .{ .tag = 4, .op = .release, .node = event, .handle = h }); diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig index 84f3ba6b..033a9808 100644 --- a/core/ninep/ctl.zig +++ b/core/ninep/ctl.zig @@ -2055,7 +2055,7 @@ test "a language server question that finds nothing, cannot be answered, or is a _ = wr(p, root_exec, "Recent\n"); const listed = p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?; p.lspRequest(listed, .incoming_calls, ""); - try testing.expect(std.mem.indexOf(u8, p.panes[listed].?.msg[0..p.panes[listed].?.msg_len], "Callers: only a file's pane asks") != null); + try testing.expect(std.mem.indexOf(u8, p.messages.saidBy(p.panes[listed].?), "Callers: only a file's pane asks") != null); // Nothing found: Callers says so, and the waiting write hears it. p.fs.late_failure_len = 0; p.lspRequest(id, .incoming_calls, ""); diff --git a/core/ninep/events.zig b/core/ninep/events.zig index e18b5d96..fe9ec79a 100644 --- a/core/ninep/events.zig +++ b/core/ninep/events.zig @@ -1089,20 +1089,20 @@ test "writing an event record back performs the action it names" { const w = wr(p, event, "FX0 10\n"); try testing.expectEqual(Status.ok, w.reply.status); - try testing.expectEqualStrings("fs-ran", pane.msg[0..pane.msg_len]); + try testing.expectEqualStrings("fs-ran", p.messages.saidBy(pane)); - pane.msg_len = 0; + p.messages.live_len = 0; try testing.expectEqual(Status.ok, wr(p, event, "FX0 10\nFX0 10\n").reply.status); - try testing.expectEqualStrings("fs-ran", pane.msg[0..pane.msg_len]); + try testing.expectEqualStrings("fs-ran", p.messages.saidBy(pane)); // The last record needs no newline, as any line file's last line. - pane.msg_len = 0; + p.messages.live_len = 0; const bare = wr(p, event, "FX0 10"); try testing.expectEqual(Status.ok, bare.reply.status); try testing.expectEqual(@as(u32, 6), bare.reply.written); - try testing.expectEqualStrings("fs-ran", pane.msg[0..pane.msg_len]); + try testing.expectEqualStrings("fs-ran", p.messages.saidBy(pane)); - pane.msg_len = 0; + p.messages.live_len = 0; for ([_][]const u8{ "FX0 10\nFQ0 1\n", // unknown type character "FX0 999\n", // out of range @@ -1111,7 +1111,7 @@ test "writing an event record back performs the action it names" { "F\n", }) |bad| { try testing.expectEqual(E.INVAL, wr(p, event, bad).errno()); - try testing.expectEqual(@as(usize, 0), pane.msg_len); + try testing.expectEqual(@as(usize, 0), p.messages.saidBy(pane).len); } // A look written back sets what look reads back. _ = wr(p, event, "FL0 3\n"); diff --git a/core/normal.zig b/core/normal.zig index 1f7ce1a7..7efe0bf6 100644 --- a/core/normal.zig +++ b/core/normal.zig @@ -1094,6 +1094,8 @@ pub fn textAction(e: Editor, t: *Text, a: modal.Normal.Action) edit.Error!void { if (comptime Editor.lib) return; // typed again by a macro, Esc is only helix's if (e.p.macro.replaying > 0) return; + // The warnings and errors first, then the previous pane. + if (e.p.messages.retire(&.{ .warn, .@"error" }) > 0) return; tagline.exitHeader(e.p); // out of a header too, as Shift-Esc return exec.runBuiltin(e.p, .Last, e.p.view().active, "", null); }, diff --git a/core/panes.zig b/core/panes.zig index 8939bd05..146b1360 100644 --- a/core/panes.zig +++ b/core/panes.zig @@ -32,7 +32,7 @@ pub const Pane = struct { pub const replica = .{ .local = .{ "pv", "pv_known" }, .derived = .{ "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "top_skip", "notices", "pan" }, - .len = .{ .{ "msg", "msg_len" }, .{ "msg_older", "msg_older_len" }, .{ "question", "question_len" }, .{ "shell_tail", "shell_tail_len" }, .{ "sel_snap", "nsel_snap" } }, + .len = .{ .{ "question", "question_len" }, .{ "shell_tail", "shell_tail_len" }, .{ "sel_snap", "nsel_snap" } }, // A picture's memory is its own allocator's (a dump loaded makes // it there). .alloc = .{ .{ "addon", "image" }, .{ "pdf", "image" }, .{ "terminal", "terminal" } }, @@ -242,8 +242,6 @@ pub const Pane = struct { /// A question with its answers in it (`repl_choice`). question: [96]u8 = undefined, question_len: u8 = 0, - /// The newest message says where an exec was sent: it is tinted. - msg_sent: bool = false, /// The revision an Exit or a Restore last warned this pane was modified /// at, and which of them: only that word goes ahead on the warning /// (builtins.zig warnModified). @@ -347,27 +345,9 @@ pub const Pane = struct { /// terminals only: the typed-text buffer standing in for shell rows ovl: ?Text.EditBuffer = null, tty_filter: bool = false, - msg: [256]u8 = undefined, - msg_len: u16 = 0, - /// Where the newest message line is in its life. - msg_life: MessageLife = .{}, - /// When it was said, in monotonic ms (Messages.expireUnattended). - msg_said_ms: i64 = 0, - /// The row (among the notice rows) the newest line holds for its life. - msg_slot: u8 = 0, - /// Earlier message lines still on screen, oldest first, each running its - /// own life: a new message stacks under them instead of replacing them. - msg_older: [message_stack]OlderMessage = undefined, - msg_older_len: u8 = 0, - /// The newest line is a builtin announcing itself in this step: what - /// the step says next replaces it rather than stacking under it. - msg_announcement: bool = false, - /// The newest line is a status (progress, a server's state): the next - /// line replaces it rather than stacking under it. - msg_status: bool = false, /// The transient lines this pane shows between its body and its tagline: - /// a builtin's message, the pending leader chord, a prompt waiting for - /// input. Rebuilt every frame from the state that owns each one, so a + /// the newest message said of it, the pending leader chord, a prompt + /// waiting for input. Rebuilt every frame from the state that owns each one, so a /// line that goes away is simply not added again and the rest close the /// gap -- there is no second copy of the truth to fall out of step. The /// body layer reserves exactly `len` rows for them, the way it already @@ -398,67 +378,14 @@ pub const Pane = struct { /// that view's focus leaving the pane drops it. prompt_view: u8 = 0, - pub const MessagePhase = enum { shown, lingering }; - /// One message line's life: shown, or lingering after the key or click - /// that dismissed it, `frame` frames of its linger gone. - pub const MessageLife = struct { - phase: MessagePhase = .shown, - frame: u16 = 0, - }; - /// Older message lines kept on screen under a new one. - pub const message_stack = 3; - pub const OlderMessage = struct { - pub const replica = .{ .len = .{.{ "text", "len" }} }; - text: [256]u8 = undefined, - len: u16 = 0, - life: MessageLife = .{}, - slot: u8 = 0, - - pub fn slice(line: *const OlderMessage) []const u8 { - return line.text[0..line.len]; - } - }; - - /// Move the newest line onto the stack of older ones, dropping the oldest - /// when it is full; the newest slot is left empty for what arrives. - pub fn pushOlderMessage(pane: *Pane) void { - if (pane.msg_older_len == message_stack) { - std.mem.copyForwards(OlderMessage, pane.msg_older[0 .. message_stack - 1], pane.msg_older[1..]); - pane.msg_older_len -= 1; - } - pane.msg_older[pane.msg_older_len] = .{ .text = pane.msg, .len = pane.msg_len, .life = pane.msg_life, .slot = pane.msg_slot }; - pane.msg_older_len += 1; - pane.msg_len = 0; - pane.msg_life = .{}; - } - - /// The first row no older line holds. A line keeps its row until it - /// leaves, and a new one fills the first gap: nothing on screen moves. - pub fn freeMessageSlot(pane: *const Pane) u8 { - var used: u8 = 0; - for (pane.msg_older[0..pane.msg_older_len]) |line| used |= @as(u8, 1) << @intCast(line.slot); - var slot: u8 = 0; - while (used & (@as(u8, 1) << @intCast(slot)) != 0) slot += 1; - return slot; - } - - pub fn removeOlderMessage(pane: *Pane, i: usize) void { - std.mem.copyForwards(OlderMessage, pane.msg_older[i .. pane.msg_older_len - 1], pane.msg_older[i + 1 .. pane.msg_older_len]); - pane.msg_older_len -= 1; - } - pub const Notices = struct { /// Painted bottom-up in this order, so a prompt keeps the row nearest /// the tagline that it has always had, and its cursor with it. - /// `older` is an earlier message line still on screen; `index` says - /// which (`Pane.msg_older`). - pub const Kind = enum { older, message, leader, prompt }; - pub const max = @typeInfo(Kind).@"enum".field_names.len - 1 + message_stack; + pub const Kind = enum { message, leader, prompt }; + pub const max = @typeInfo(Kind).@"enum".field_names.len; kinds: [max]Kind = undefined, - index: [max]u8 = @splat(0), - /// Each band's row below the body's top: message lines keep theirs, - /// so a band that leaves leaves a gap rather than moving the rest. + /// Each band's row below the body's top. row: [max]u8 = @splat(0), /// Where each band's chip starts, as an absolute grid column. A chip /// is only as wide as its own text, so the rest of the row underneath @@ -468,14 +395,9 @@ pub const Pane = struct { /// A band on the next row after every band so far. pub fn push(n: *Notices, kind: Kind) void { - n.pushAt(kind, 0, n.span()); - } - - pub fn pushAt(n: *Notices, kind: Kind, index: u8, row: u8) void { if (n.len >= max) return; n.kinds[n.len] = kind; - n.index[n.len] = index; - n.row[n.len] = row; + n.row[n.len] = n.span(); n.left[n.len] = std.math.maxInt(u16); n.len += 1; } @@ -1669,14 +1591,14 @@ test "owned cwd preserves long paths aliases and failed updates" { const effects = p.effects_len; exec.saveTo(p, 0, "file.txt"); try std.testing.expectEqual(effects, p.effects_len); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "path too long") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "path too long") != null); const current = pane.cwdSlice(); allocator.fail_index = allocator.alloc_index; p.setCwd(.at(0), "/replacement"); try std.testing.expectEqual(current.ptr, pane.cwdSlice().ptr); try std.testing.expectEqualStrings(&path, pane.cwdSlice()); - try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "out of memory") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(pane), "out of memory") != null); allocator.fail_index = std.math.maxInt(usize); p.setCwd(.at(0), "/replacement"); try std.testing.expectEqualStrings("/replacement", pane.cwdSlice()); @@ -1781,7 +1703,7 @@ test "owned cwd EOF failure retains the pane and Del retries its close" { try std.testing.expectEqual(parent, p.panes[0].?); try std.testing.expectEqual(parent, child.cwd.inherited); try std.testing.expectEqual(Text.Mode.normal, parent.body.mode); - try std.testing.expect(std.mem.indexOf(u8, parent.msg[0..parent.msg_len], "Del retries close") != null); + try std.testing.expect(std.mem.indexOf(u8, p.messages.saidBy(parent), "Del retries close") != null); try std.testing.expectEqual(@as(usize, 0), p.effects_len); allocator.fail_index = std.math.maxInt(usize); try std.testing.expect(p.executeBuiltinLine(0, "Del")); diff --git a/core/root.zig b/core/root.zig index 63b77964..c7163400 100644 --- a/core/root.zig +++ b/core/root.zig @@ -623,7 +623,7 @@ const machine_lines = [_]struct { []const u8, usize, []const u8 }{ .{ "FrameStats.zig", 7, "a frame's clock and log: frames are local, never digested" }, .{ "Handover.zig", 29, "a window carried to another process over a socket: the session's host" }, .{ "Kind.zig", 1, "host_io's KindJob: a kind's job is the host's" }, - .{ "Messages.zig", 6, "the message clock, read through tape.value(.clock); PARDES_NOTIME, the tests', read by a host's `stamp` alone (between steps, or in a host's call), whose text the tape carries in the setMessage it makes: never a step's" }, + .{ "Messages.zig", 4, "PARDES_NOTIME, the tests', and the time of day, read by a host's `stamp` alone (between steps, or in a host's call), whose text the tape carries in the setMessage it makes: never a step's" }, .{ "Output.zig", 2, "the fonts module (Fonts lists them under tape.site(.fonts)) and the build's version line" }, .{ "Stream.zig", 14, "the disk search's worker: it runs off the step and its batches are inputs" }, .{ "builtins.zig", 2, "Mount's probe (tape.site(.probe)) and Term's shell check (tape.site(.shell))" }, |
