diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 23:08:45 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 23:20:24 -0300 |
| commit | 5c941c2278a4e099f3cd4bae1b29a783f88a95b0 (patch) | |
| tree | dabbe402d1319c53d2ba4ca05d6bef227b3e4704 /core/Pick.zig | |
| parent | c9114545cce7f7598a4929d8254de1d3baccde84 (diff) | |
| download | pardes-5c941c2278a4e099f3cd4bae1b29a783f88a95b0.tar.gz pardes-5c941c2278a4e099f3cd4bae1b29a783f88a95b0.zip | |
Messages, Pick, Output: where jumps walk, SPC e lands an error's places as a list in the pane's walk through D's picker, and SPC h m is a picker over the history in the pane's tag (walk UI G item 2c, SPEC §10.4, §5.1's messages source), C's stopgaps replaced: SPC e (Messages.act) made a +Search under the pane and walked it with the Look walk; now, when Pick.asked (jumps walk, not a 9P script), it opens Pick's `list` with the places as rows, its word `✗ <cause>` (cut at a character's start to the word's 24 bytes), and lands its first row at once as the prototype's actOnMessage does (openPicker then accept): the pane steps (or its reader, the pane being held), the list word goes into its trail before the place, n and N walk the places through Pick.walkList; the history (Messages.history, from SPC e with nothing to act on and from the Messages word, SPC h m) is Pick's new source `messages`, its rows Output.messagesText (openMessages' text, split out), the newest first, a place indented under its error; Enter on a message row gives the keyboard to its cause's pane while it is open, on a place row Looks the place; C-q keeps it as the +Messages (Pick.keep); the source is not offered among the picker's other sources (its second row), as `list` is not; where jumps open panes, and for a 9P script, both are as C made them; the Message and Messages docs say so (builtins-{tui,gui}.json regenerated); TEST FIRST: Messages.zig 'where jumps walk, SPC e lands an error's places as a list in the pane's walk, n walking them; SPC h m is a picker over the history…' (no pane made, the caret on the first place and then the second, the word `✗ @p9 zig build 1/2` then `2/2` in the tag, the history's rows newest first, Enter on a message, C-q the +Messages); C's own SPC e test keeps the +Search way (jumps open panes there); GOLDENS: builtins (SPC h m's doc two rows longer: the rows under it, Tutor's among them, two lower; the +Look's line 237 for 236; tty_boot.zig's click on Tutor's row 32 for 30) and leader (the same doc rows in help-group), nothing else; tui core-test 1035/1204 (169 skipped), process-test 0 of 146 failed after those two updates (2 before them: those two)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/Pick.zig')
| -rw-r--r-- | core/Pick.zig | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/core/Pick.zig b/core/Pick.zig index 7913a7e0..fa1c3230 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -46,9 +46,10 @@ const Key = pardes.Key; /// under the asking pane's directory, the lines of them holding the /// query, the files opened lately, the panes, the asking text's /// declarations, the lines holding the query in every open pane (All, its -/// places in each), the jump list, and rows handed over (a language -/// server's answer), titled by their word. -pub const Source = enum { find, grep, recent, panes, symbols, all, jumplist, list }; +/// places in each), the jump list, rows handed over (a language server's +/// answer, SPC e's places), titled by their word, and the messages' +/// history (SPC h m). +pub const Source = enum { find, grep, recent, panes, symbols, all, jumplist, list, messages }; /// Each source's word in the tag and the leader keys of the builtin that /// opens it, its key cells (`␣ f Find`). @@ -61,6 +62,7 @@ const words = std.EnumArray(Source, struct { word: []const u8, keys: []const u8 .all = .{ .word = "All", .keys = "" }, .jumplist = .{ .word = "Jumplist", .keys = "j" }, .list = .{ .word = "List", .keys = "l" }, + .messages = .{ .word = "Messages", .keys = "hm" }, }); /// The pickers kept after they roll up, for their list words and Resume. @@ -278,6 +280,12 @@ fn start(p: *Pardes, pk: *Pick) void { addRows(p, pk, out.written()); }, .list => addRows(p, pk, pk.rows), + .messages => { + var out: std.Io.Writer.Allocating = .init(p.gpa); + defer out.deinit(); + Output.messagesText(p, &out.writer) catch return; + addRows(p, pk, out.written()); + }, } } @@ -499,6 +507,24 @@ fn rowAt(p: *Pardes, pk: *const Pick, arena: std.mem.Allocator, i: usize) !Row { const path = if (t.path[0] == '/' or t.path[0] == '@') t.path else try std.Io.Dir.path.join(arena, &.{ dir, t.path }); row.target = .{ .place = .{ .path = path, .at = t.at } }; }, + // A message (`✗ 3: words`, Output.messagesText): its cause's pane + // while it is open; a place under it (indented): that place. + .messages => { + const lead = text.len - std.mem.trimStart(u8, text, " ").len; + if (lead == 0) { + const sp = std.mem.indexOfScalar(u8, text, ' ') orelse return row; + const digits = text[sp + 1 ..]; + const n = std.mem.indexOfNone(u8, digits, "0123456789") orelse return row; + if (n == 0 or digits[n] != ':') return row; + const serial = std.fmt.parseInt(u32, digits[0..n], 10) catch return row; + if (p.paneBySerial(serial) != null) row.target = .{ .pane = serial }; + return row; + } + const t = look.parsePathLine(text[lead..]); + row.pre = @intCast(lead + t.end); + if (t.path.len == 0) return row; + row.target = .{ .place = .{ .path = t.path, .at = t.at } }; + }, } return row; } @@ -553,7 +579,7 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { for (acts) |act| if (offered(pk, act)) try text.print(arena, "{s} ", .{act.word}); try text.appendSlice(arena, "|"); var first = false; - inline for (comptime std.enums.values(Source)) |src| if (src != .list) { + inline for (comptime std.enums.values(Source)) |src| if (src != .list and src != .messages) { if (src != pk.source) { if (!first) try text.append(arena, ' '); first = false; @@ -961,6 +987,11 @@ fn back(p: *Pardes, pk: *Pick) void { fn keep(p: *Pardes, pk: *Pick) void { const s = &p.view().tag_state; const from = p.paneBySerial(pk.owner) orelse p.view().active; + // The history kept is the +Messages (SPEC §10.4). + if (pk.source == .messages) { + TagState.toRest(p); + return Output.openMessages(p, from) catch |err| p.reportError(.at(from), "messages", err); + } var out: std.Io.Writer.Allocating = .init(p.gpa); defer out.deinit(); var arena = std.heap.ArenaAllocator.init(p.gpa); |
