From 2e29f8ffebda59aa528c392535b7f1db31be91f8 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 21:27:16 -0300 Subject: messages: SPC e acts on the message the notice row leads with, SPC h m is the history newest first, and Esc at rest takes a thing at a time (pick-ui SPEC §10.4, walk UI line C item 5): the Message word (SPC e, quiet: what it does shows) lists an error's places in a +Search under the pane and lands on the first (today's list, walked by the Look walk until agent D's picker lands lists in the pane), the error gone; a question gets the keyboard in its tag (View.answering, item 4); anything else, or nothing, opens the history; the history (Messages, SPC h m) is the log ring newest first, each line its kind's glyph, a live error's places under it, a question's answer logged after it; Esc in normal mode at rest takes a search's tints first (Places.clear), then the warnings and errors, then the extra selections (the primary kept), and only then goes back to the previous pane; tests: Messages.zig 'SPC e on an error that names places lists them under the pane and lands on the first, on a question gives its tag the keyboard, and on anything else opens the history, the newest first', 'Esc at rest takes a search's tints first, then the warnings and errors, and only then goes back'; docs/typ/builtins-tui.json from the registry; tui: core-test, shell-test, pane-test, behaviour-test pass; process-test 0 of 146 failed after the builtins and leader goldens took the Messages word's longer doc line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- core/Output.zig | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'core/Output.zig') diff --git a/core/Output.zig b/core/Output.zig index 380fadb1..a7398ccf 100644 --- a/core/Output.zig +++ b/core/Output.zig @@ -979,19 +979,27 @@ pub fn openConfig(p: *Pardes, id: usize) !void { return openRead(p, id, .{ .cmd = .DumpConfig }, "", content); } -/// The message-row log, oldest first — the lines that were said in passing and -/// then cleared by the next keystroke. +/// The messages' history (the log ring), the newest first, each with its +/// kind's glyph, a live error's places under it (SPC h m). pub fn openMessages(p: *Pardes, id: usize) !void { var out: std.Io.Writer.Allocating = .init(p.gpa); errdefer out.deinit(); - var i: usize = 0; - while (p.messages.at(i)) |m| : (i += 1) { + var i: usize = p.messages.len; + while (i > 0) { + i -= 1; + const m = p.messages.at(i).?; + try out.writer.print("{s} ", .{m.kind.glyph()}); if (m.serial != 0) try out.writer.print("{d}: ", .{m.serial}); try out.writer.writeAll(m.slice()); if (m.repeats > 1) try out.writer.print(" (x{d})", .{m.repeats}); try out.writer.writeByte('\n'); + for (p.messages.live[0..p.messages.live_len]) |*s| { + if (s.kind != .@"error" or s.places_len == 0 or !std.mem.eql(u8, pardes.Messages.Message.body(s.text.slice()), pardes.Messages.Message.body(m.slice()))) continue; + for (s.places[0..s.places_len]) |*place| try out.writer.print(" {s}:{d}:{d} {s}\n", .{ place.path.slice(), place.line, place.col, place.text.slice() }); + break; + } } - if (i == 0) try out.writer.writeAll("nothing has been said yet\n"); + if (p.messages.len == 0) try out.writer.writeAll("nothing has been said yet\n"); const content = try out.toOwnedSlice(); return openRead(p, id, .{ .cmd = .Messages }, "", content); } -- cgit v1.3