summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-25 10:02:29 -0300
committerGabriel Schneider <[email protected]>2026-11-25 10:02:29 -0300
commit98f5abfc10d9984a69940a6805d974018e5ea01e (patch)
tree6742290772cb87a8cfdd57bd3fa85d5b4043f21f /core
parenta6d2b61bd78768cf4bbf177717ffea319825de69 (diff)
downloadpardes-98f5abfc10d9984a69940a6805d974018e5ea01e.tar.gz
pardes-98f5abfc10d9984a69940a6805d974018e5ea01e.zip
Messages, body_layer, normal, mouse, Core: a message's detail unrolls only on request (UX D13, E5 fix 3): K with one selection on a line a message with a detail names, SPC e there, or a Look (B3) on its words after the line unrolls it under that line, and the caret leaving the line (or the keyboard another pane) rolls it up; the caret passing a line never inserts or removes rows; THE CAUSE: Messages.detailUnder showed the detail of the message naming the caret's line whenever the caret was on it (C's rule, spec §10.2), so j over a build error pushed the text below down and k pulled it back (UX A16, E2 "detail still unrolls under the caret"); THE FIX: Said.open (the question's Diff's flag, already in the dump and the digest; its doc said "whatever the caret" and nothing read it) is the request: detailUnder shows the message whose words the caret's line shows (the first naming it, firstAt, as messageGhosts draws them) only while it is open, and a question's Diff under its place whatever the caret; Messages.detailAt finds it (not a question's: its Diff is `d`); normal.zig's K takes it with one selection, else keep's prompt as before; Messages.act (SPC e) unrolls it first when the caret's line has one not shown, the walk as before when asked again; mouse.zig: a Look on its words after the line (body_layer.messageAt: from their glyph two blanks after the line, read from the frame drawn last, as wordAt reads a detail's word; wordAt and it share drawnRow) toggles it; Core.update: around a key and a click, Messages.unrolledAt/rollUp roll every unrolled detail (not a question's Diff) up when the keyboard's pane or its caret's line changed (a motion along the line, or a click on the detail, which puts the caret on the line it explains, keeps it: C's G-fixed rule holds, the detail's rows are read-only text for the mouse); nothing read with no detail unrolled; the Message builtin's doc says it (docs/typ/builtins-tui.json and -gui.json the same text); TEST FIRST: body_layer.zig "a message's detail unrolls only on request (UX D13): the caret passing its line inserts no rows; K there unrolls it ...; K with two selections is keep's" (fails on the base at body_layer.zig:1346: the caret on line 3 put its detail under it); C's two tests ask for the detail (err.open, and K after k k) where they set the caret; core-test 1084/1255 (171 skipped), process-test 0 of 147 failed (no golden moved); a user hit it: every build error and diagnostic with detail lines pushed the text below down as the caret passed
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core')
-rw-r--r--core/Core.zig9
-rw-r--r--core/Messages.zig98
-rw-r--r--core/body_layer.zig113
-rw-r--r--core/builtins.zig5
-rw-r--r--core/mouse.zig6
-rw-r--r--core/normal.zig11
6 files changed, 213 insertions, 29 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 5b6eba75..056af9db 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -1795,9 +1795,16 @@ fn updateInner(p: *Pardes, ev: Event) void {
p.can_ask = true;
defer p.can_ask = false;
p.typedInto();
+ // A detail unrolled on request rolls up at the next motion (UX D13).
+ const was = Messages.unrolledAt(p);
@import("keys.zig").handleKey(p, key);
+ Messages.rollUp(p, was);
+ },
+ .mouse => |m| {
+ const was = Messages.unrolledAt(p);
+ mouse.handleMouse(p, m);
+ Messages.rollUp(p, was);
},
- .mouse => |m| mouse.handleMouse(p, m),
.paste => |bytes| {
p.typedInto();
edit.applyPaste(p, bytes) catch |err| p.reportError(.at(v.active), "paste", err);
diff --git a/core/Messages.zig b/core/Messages.zig
index 2cb196f6..b821ab35 100644
--- a/core/Messages.zig
+++ b/core/Messages.zig
@@ -129,15 +129,17 @@ pub const Said = struct {
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.
+ /// The lines that explain it, shown under the line it names when asked
+ /// (`open`).
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,
- /// Its detail shown under its first place's line whatever the caret
- /// (a question's Diff).
+ /// Its detail unrolled, on request only (UX D13): K, SPC e or a Look on
+ /// its words on the caret's line (detailAt), shown under that line until
+ /// the caret leaves it (rollUp); a question's Diff under its place
+ /// whatever the caret, until `d` again.
open: bool = false,
/// How many times in a row it was said.
n: u16 = 1,
@@ -520,8 +522,9 @@ pub fn answer(p: *Pardes, i: usize, key: u8) bool {
return true;
}
-/// SPC e (the Message word, SPEC §10.4), on the message the notice row
-/// leads with: an error that names places lands them as a list in pane
+/// SPC e (the Message word, SPEC §10.4): on a line a message names, its
+/// detail not unrolled, that detail (UX D13); else on the message the
+/// notice row leads with: an error that names places lands them as a list in pane
/// `id`'s walk (Pick's `list`, its word `✗ <cause>` in the trail), the
/// first landed on, n and N walking the rest, and the error goes (a
/// +Search under the pane where jumps do not walk, or for a 9P script:
@@ -529,6 +532,13 @@ pub fn answer(p: *Pardes, i: usize, key: u8) bool {
/// else, or nothing, opens the history.
pub fn act(p: *Pardes, id: usize) void {
const m = &p.messages;
+ // On a line a message names, its detail not unrolled: unrolled (UX
+ // D13), the message kept; asked again, the walk below.
+ if (id < MAX_PANES) if (p.panes[id]) |pane| if (pane.focus == .body) if (detailAt(p, pane, pane.body.cur_row)) |s| if (!s.open) {
+ s.open = true;
+ p.needs_frame = true;
+ return;
+ };
const lead = m.headline() orelse return history(p, id);
if (lead.kind == .question) {
p.view().answering = lead.pane;
@@ -949,29 +959,83 @@ pub fn collectNotices(p: *Pardes, pane: *Pane, r: Rect) void {
}
}
-/// A message's detail under the caret's line (SPEC §10.2), as a body of
-/// `body_h` rows shows it: the row of that line's last row, how many of the
-/// detail's lines fit under it, the message (the first naming the line, as
-/// the words after it are); only in the pane with the keyboard, in its body.
-/// Bounded by the live messages' places and the rows shown.
+/// A message's detail unrolled (SPEC §10.2, UX D13: on request only), as a
+/// body of `body_h` rows shows it: the row of its line's last row, how many
+/// of the detail's lines fit under it, the message. The line is the
+/// caret's, where it was asked (the caret leaving it rolls it up), or a
+/// question's place; its message the first naming it, as the words after
+/// it are (firstAt). The caret passing a line never unrolls one. Only in
+/// the pane with the keyboard, in its body. Bounded by the live messages'
+/// places and the rows shown.
pub fn detailUnder(p: *const Pardes, pane: *Pane, active: bool, body_h: u16) ?struct { row: u16, rows: u16, said: *const Said } {
if (!active or pane.focus != .body or p.messages.live_len == 0) return null;
const f = pane.file orelse return null;
- const caret = @max(0, pane.body.cur_row);
- const said = found: for (p.messages.live[0..p.messages.live_len]) |*s| {
- for (s.places[0..s.places_len]) |*place| if (place.line == caret + 1 and std.mem.eql(u8, place.path.slice(), f.path)) break :found s;
- } else return null;
+ const m = &p.messages;
+ const caret: u32 = @intCast(@max(0, pane.body.cur_row));
+ const said, const line = found: {
+ if (m.firstAt(f.path, caret + 1)) |i| if (m.live[i].open) break :found .{ &m.live[i], @as(i32, @intCast(caret)) };
+ for (m.live[0..m.live_len], 0..) |*s, i| if (s.open and s.kind == .question and s.places_len > 0 and std.mem.eql(u8, s.places[0].path.slice(), f.path))
+ if (m.firstAt(f.path, s.places[0].line) == i) break :found .{ s, @as(i32, @intCast(s.places[0].line -| 1)) };
+ return null;
+ };
if (said.detail_len == 0) return null;
var row: u16 = 0;
while (row < body_h) : (row += 1) {
- if (pane.wrapAt(p.settings.tab, row).line != caret) continue;
- if (row + 1 < body_h and pane.wrapAt(p.settings.tab, row + 1).line == caret) continue;
+ if (pane.wrapAt(p.settings.tab, row).line != line) continue;
+ if (row + 1 < body_h and pane.wrapAt(p.settings.tab, row + 1).line == line) continue;
const k: u16 = @intCast(@min(said.detail_len, body_h - row - 1));
return if (k == 0) null else .{ .row = row, .rows = k, .said = said };
}
return null;
}
+/// The first live message naming line `line` (1-based) of `path`: the one
+/// whose words are drawn after that line (body_layer messageGhosts).
+fn firstAt(m: *const Messages, path: []const u8, line: u32) ?usize {
+ for (m.live[0..m.live_len], 0..) |*s, i| for (s.places[0..s.places_len]) |*place| {
+ if (line > 0 and place.line == line and std.mem.eql(u8, place.path.slice(), path)) return i;
+ };
+ return null;
+}
+
+/// The message whose words line `row` (0-based) of `pane`'s file shows,
+/// when it has a detail to unroll (UX D13): what K with one selection, SPC
+/// e and a Look on those words ask for. Not a question's (its Diff is `d`).
+pub fn detailAt(p: *Pardes, pane: *const Pane, row: i32) ?*Said {
+ const f = pane.file orelse return null;
+ if (row < 0) return null;
+ const s = &p.messages.live[p.messages.firstAt(f.path, @intCast(row + 1)) orelse return null];
+ if (s.detail_len == 0 or s.kind == .question) return null;
+ return s;
+}
+
+/// The keyboard's pane and its caret's line while a detail is unrolled on
+/// request; null with none (nothing to roll up: nothing else read).
+pub const Caret = struct { active: usize, row: i32 };
+
+pub fn unrolledAt(p: *const Pardes) ?Caret {
+ const v = p.view();
+ for (p.messages.live[0..p.messages.live_len]) |*s| if (s.open and s.kind != .question) {
+ const pane = p.panes[v.active] orelse return .{ .active = v.active, .row = -1 };
+ return .{ .active = v.active, .row = pane.body.cur_row };
+ };
+ return null;
+}
+
+/// After a key or a click (Core.update): the caret left its line, or the
+/// keyboard went to another pane, since `was`: every detail unrolled on
+/// request rolls up (UX D13: the next motion; a motion along the line, or
+/// a click on the detail, which puts the caret on the line it explains,
+/// keeps it), a question's Diff stays.
+pub fn rollUp(p: *Pardes, was: ?Caret) void {
+ const before = was orelse return;
+ const now = unrolledAt(p) orelse return;
+ if (std.meta.eql(before, now)) return;
+ for (p.messages.live[0..p.messages.live_len]) |*s| if (s.kind != .question) {
+ s.open = false;
+ };
+}
+
/// The bands a pane shows over `r` below its `tag_rows`: the live view's
/// each step, and any view's for its kind's facts (Kind.viewOf), made from
/// what a dump keeps (the bands are derived).
diff --git a/core/body_layer.zig b/core/body_layer.zig
index 0107b3e0..f00da4a9 100644
--- a/core/body_layer.zig
+++ b/core/body_layer.zig
@@ -641,6 +641,28 @@ fn messageGhosts(p: *Pardes, s: *Surface, pane: *Pane, tx: u16, tw: u16, body_y:
/// frame drawn last (its body layer when it has one, else the grid): a
/// message's detail is text no buffer holds, read as it is shown.
pub fn wordAt(p: *Pardes, arena: std.mem.Allocator, id: usize, row: usize, col: usize) !?[]const u8 {
+ const text = try drawnRow(p, arena, id, row) orelse return null;
+ const b = pardes.tagline.wordBoundsAtCol(text, panes.File.rawAtDisplay(p.settings.tab, text, col)) orelse return null;
+ if (b.lo == b.hi) return null;
+ return text[b.lo..b.hi];
+}
+
+/// The message whose words are drawn after its line at body row `row`,
+/// text column `col` of pane `id` in the frame drawn last, when it has a
+/// detail: a Look there unrolls it (UX D13). The words start at their
+/// glyph, two blanks after the line (messageGhosts).
+pub fn messageAt(p: *Pardes, arena: std.mem.Allocator, id: usize, row: u16, col: usize) !?*pardes.Messages.Said {
+ const pane = p.panes[id] orelse return null;
+ const said = pardes.Messages.detailAt(p, pane, pane.wrapAt(p.settings.tab, pane.textRow(row)).line) orelse return null;
+ const text = try drawnRow(p, arena, id, row) orelse return null;
+ var mark: [8]u8 = undefined;
+ const at = std.mem.lastIndexOf(u8, text, std.fmt.bufPrint(&mark, " {s} ", .{said.kind.glyph()}) catch return null) orelse return null;
+ return if (panes.File.rawAtDisplay(p.settings.tab, text, col) >= at + 2) said else null;
+}
+
+/// Body row `row` of pane `id` as the frame drawn last shows it: its body
+/// layer's when it has one, else the grid's.
+fn drawnRow(p: *Pardes, arena: std.mem.Allocator, id: usize, row: usize) !?[]const u8 {
const layer = &p.surface.body_layers[id];
const body = (p.surface.region(.body, id) orelse return null).rect;
var text: std.ArrayList(u8) = .empty;
@@ -651,9 +673,7 @@ pub fn wordAt(p: *Pardes, arena: std.mem.Allocator, id: usize, row: usize, col:
if (row >= body.h) return null;
for (0..body.w) |x| try text.appendSlice(arena, p.surface.at(body.x + @as(u16, @intCast(x)), body.y + @as(u16, @intCast(row))).grapheme());
}
- const b = pardes.tagline.wordBoundsAtCol(text.items, panes.File.rawAtDisplay(p.settings.tab, text.items, col)) orelse return null;
- if (b.lo == b.hi) return null;
- return text.items[b.lo..b.hi];
+ return text.items;
}
/// A picker's landing line (UX D7): its text on the hit ground across
@@ -1141,7 +1161,7 @@ fn rowText(s: *const Surface, x: u16, y: u16, buf: []u8) []const u8 {
return buf[0..n];
}
-test "a build error is said where its cause is: the mark on its file's tag, its words after its line, its detail under the caret's line pushing the rows below down, the walk on the notice row" {
+test "a build error is said where its cause is: the mark on its file's tag, its words after its line, its detail, asked for, under its line pushing the rows below down, the walk on the notice row" {
const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 20 });
defer p.deinit();
const pane = try p.setTestFile("one\ntwo\nthree\nfour\nfive\nsix\n");
@@ -1172,8 +1192,10 @@ test "a build error is said where its cause is: the mark on its file's tag, its
// elsewhere.
try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 2, &buf), "three \u{2717} expected 2 argument(s), found 3") != null);
try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 3, &buf), "four") != null);
- // The caret on line 3: its detail under it, the rows below two rows down.
+ // The caret on line 3 and its detail asked for (K, UX D13): under the
+ // line, the rows below two rows down.
pane.body.cur_row = 2;
+ err.open = true;
_ = frame.reset(.retain_capacity);
s = try p.render(frame.allocator());
try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 3, &buf), "const x = f(1, 2, 3);") != null);
@@ -1202,6 +1224,7 @@ test "a click under a message's detail lands on the row drawn there, a click on
err.detail_len = 2;
pane.focus = .body;
pane.body.cur_row = 2;
+ err.open = true;
p.sync();
var frame = std.heap.ArenaAllocator.init(std.testing.allocator);
defer frame.deinit();
@@ -1215,9 +1238,14 @@ test "a click under a message's detail lands on the row drawn there, a click on
p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = x, .row = body.y + 6 } });
p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = x, .row = body.y + 6 } });
try std.testing.expectEqual(@as(i32, 4), pane.body.cur_row);
- // On line 3 again, its detail drawn: a click on the detail is on the
- // line it explains, and the detail stays.
- pane.body.cur_row = 2;
+ // On line 3 again, its detail asked for again (the click, a motion,
+ // rolled it up): a click on the detail is on the line it explains, and
+ // the detail stays.
+ try std.testing.expect(!err.open);
+ p.update(.{ .key = .{ .cp = 'k' } });
+ p.update(.{ .key = .{ .cp = 'k' } });
+ p.update(.{ .key = .{ .cp = 'K' } });
+ try std.testing.expect(err.open);
_ = frame.reset(.retain_capacity);
s = try p.render(frame.allocator());
const wrap_at = std.mem.indexOf(u8, rowText(s, body.x, body.y + 3, &buf), "Wrap").?;
@@ -1317,3 +1345,72 @@ test "a motion root's level paints its targets in place of their lines' numbers,
s = try p.render(a);
try std.testing.expectEqualStrings("5", Field.of(s, gutter, body.y + 4, number, &buf));
}
+
+test "a message's detail unrolls only on request (UX D13): the caret passing its line inserts no rows; K there unrolls it under the line and the caret leaving the line rolls it up; SPC e there unrolls it; a Look on its words after the line unrolls it; K with two selections is keep's" {
+ const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 20 });
+ defer p.deinit();
+ const pane = try p.setTestFile("one\ntwo\nthree\nfour\nfive\nsix\n");
+ const id = p.view().active;
+ const err = pardes.Messages.keep(p, .@"error", 0, "@p9 zig build", "exit 1");
+ err.places[0] = .{ .line = 3, .col = 1 };
+ err.places[0].path.set("/test.txt");
+ err.places[0].text.set("expected 2 argument(s), found 3");
+ err.places_len = 1;
+ err.detail[0] = .{};
+ err.detail[0].set("const x = f(1, 2, 3);");
+ err.detail_len = 1;
+ pane.focus = .body;
+ p.sync();
+ var frame = std.heap.ArenaAllocator.init(std.testing.allocator);
+ defer frame.deinit();
+ var buf: [512]u8 = undefined;
+ // The caret onto line 3 and past it: no row inserted or removed.
+ p.update(.{ .key = .{ .cp = 'j' } });
+ p.update(.{ .key = .{ .cp = 'j' } });
+ try std.testing.expectEqual(@as(i32, 2), pane.body.cur_row);
+ var s = try p.render(frame.allocator());
+ const body = s.region(.body, id).?.rect;
+ try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 2, &buf), "three \u{2717} expected") != null);
+ try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 3, &buf), "four") != null);
+ // K there: its detail under the line, the rows below one lower; no
+ // keep prompt.
+ p.update(.{ .key = .{ .cp = 'K' } });
+ try std.testing.expectEqual(pardes.TagState.Kind.rest, p.view().tag_state.kind);
+ _ = frame.reset(.retain_capacity);
+ s = try p.render(frame.allocator());
+ try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 3, &buf), "const x = f(1, 2, 3);") != null);
+ try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 4, &buf), "four") != null);
+ // The next motion rolls it up; back on the line, nothing comes back.
+ p.update(.{ .key = .{ .cp = 'j' } });
+ p.update(.{ .key = .{ .cp = 'k' } });
+ try std.testing.expect(!err.open);
+ _ = frame.reset(.retain_capacity);
+ s = try p.render(frame.allocator());
+ try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 3, &buf), "four") != null);
+ // SPC e there: unrolled, the error still live; K rolls it up.
+ p.update(.{ .key = .{ .cp = ' ' } });
+ p.update(.{ .key = .{ .cp = 'e' } });
+ try std.testing.expect(err.open);
+ try std.testing.expectEqual(@as(usize, 1), p.messages.live_len);
+ _ = frame.reset(.retain_capacity);
+ s = try p.render(frame.allocator());
+ try std.testing.expect(std.mem.indexOf(u8, rowText(s, body.x, body.y + 3, &buf), "const x = f(1, 2, 3);") != null);
+ p.update(.{ .key = .{ .cp = 'K' } });
+ try std.testing.expect(!err.open);
+ // A Look (B3) on its words after the line: unrolled, the caret where
+ // it was.
+ _ = frame.reset(.retain_capacity);
+ s = try p.render(frame.allocator());
+ const words = std.mem.indexOf(u8, rowText(s, body.x, body.y + 2, &buf), "expected").?;
+ const wx = body.x + @as(u16, @intCast(words)) + 1;
+ p.update(.{ .mouse = .{ .button = .right, .kind = .press, .col = wx, .row = body.y + 2 } });
+ p.update(.{ .mouse = .{ .button = .right, .kind = .release, .col = wx, .row = body.y + 2 } });
+ while (p.nextEffect()) |_| {}
+ try std.testing.expect(err.open);
+ try std.testing.expectEqual(@as(i32, 2), pane.body.cur_row);
+ // K with two selections is keep's prompt, the detail as it was.
+ p.update(.{ .key = .{ .cp = 'C' } });
+ try std.testing.expect(pane.body.nsel > 0);
+ p.update(.{ .key = .{ .cp = 'K' } });
+ try std.testing.expectEqual(pardes.TagState.Kind.prompt, p.view().tag_state.kind);
+}
diff --git a/core/builtins.zig b/core/builtins.zig
index 33f5824f..7aaeee40 100644
--- a/core/builtins.zig
+++ b/core/builtins.zig
@@ -1727,8 +1727,9 @@ pub const LocationsConfig = struct {
/// Act on the message the notice row leads with.
///
-/// An error that names places lands them as a list in the pane's walk, n
-/// and N walking them (where jumps do not walk, a +Search the Look walk
+/// On a line a message names, its detail not shown yet: that detail, under
+/// the line until the caret leaves it. Else an error that names places
+/// lands them as a list in the pane's walk, n and N walking them (where jumps do not walk, a +Search the Look walk
/// steps through); a question takes the keyboard in its pane's tag (its
/// answer's key answers it, Esc leaves it waiting); anything else opens the
/// history.
diff --git a/core/mouse.zig b/core/mouse.zig
index 6516ea71..72f599dd 100644
--- a/core/mouse.zig
+++ b/core/mouse.zig
@@ -884,6 +884,12 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void {
const word = (body_layer.wordAt(p, arena, id, row, @intCast(@max(0, pointed.sel.c0))) catch return) orelse return;
return exec.runBuiltin(p, if (m.button == config.exec_button) config.exec_cmd else config.look_cmd, id, "", arena.dupe(u8, word) catch return);
}
+ // A Look on a message's words after its line: its
+ // detail unrolled, or rolled up (UX D13).
+ if (m.button == config.look_button and !pointed.on_tag and mrow >= body_y) if (body_layer.messageAt(p, p.scratch.allocator(), id, mrow - body_y, @intCast(@max(0, pointed.sel.c0))) catch null) |said| {
+ said.open = !said.open;
+ return;
+ };
pane.clearPointerSelection(@backingInt(m.button));
pane.sel[@backingInt(m.button)] = pointed.sel;
v.drag = .{
diff --git a/core/normal.zig b/core/normal.zig
index 3aad765d..e6d6dbb0 100644
--- a/core/normal.zig
+++ b/core/normal.zig
@@ -1369,7 +1369,16 @@ fn executeNormalAction(p: *Pardes, t: *Text, a: modal.Normal.Action) edit.Error!
.page_up => return t.scrollViewMove(p.settings.tab, text, range, -@as(i32, pane.rows)),
// s, S and | answer for the text they are pressed in; `/` searches
// the body wherever it is pressed, as acme's Look from a tag does.
- inline .select_regex, .split_regex, .keep_regex, .remove_regex => |role| return startSelRegex(p, pane, t, @field(modal.Normal.RegexMode, @tagName(role)[0 .. @tagName(role).len - "_regex".len])),
+ // K with one selection on a line a message with a detail names:
+ // that detail unrolled, or rolled up (UX D13); else keep's prompt.
+ .keep_regex => {
+ if (t == &pane.body and t.nsel == 0) if (pardes.Messages.detailAt(p, pane, t.cur_row)) |said| {
+ said.open = !said.open;
+ return;
+ };
+ return startSelRegex(p, pane, t, .keep);
+ },
+ inline .select_regex, .split_regex, .remove_regex => |role| return startSelRegex(p, pane, t, @field(modal.Normal.RegexMode, @tagName(role)[0 .. @tagName(role).len - "_regex".len])),
// Language shortcuts run the same builtins as tags and leader commands.
.goto_definition => return exec.runBuiltin(p, .Def, v.active, "", null),
.goto_references => return exec.runBuiltin(p, .Refs, v.active, "", null),