summaryrefslogtreecommitdiff
path: root/core/normal.zig
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/normal.zig
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/normal.zig')
-rw-r--r--core/normal.zig11
1 files changed, 10 insertions, 1 deletions
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),