diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 23:20:24 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 23:37:04 -0300 |
| commit | 5c938585963818743139439bfc5db6a15c90e10b (patch) | |
| tree | e4f16fe8896bcba5678ea05b6805d88c0b11f640 /core/Messages.zig | |
| parent | 5c941c2278a4e099f3cd4bae1b29a783f88a95b0 (diff) | |
| download | pardes-5c938585963818743139439bfc5db6a15c90e10b.tar.gz pardes-5c938585963818743139439bfc5db6a15c90e10b.zip | |
Messages, body_layer, edit, mouse, panes: a click lands on what is drawn under it while a message's detail is unrolled under the caret's line, and the detail's rows are read-only text for the mouse (walk UI G item 2d, the user's "everything a pane shows is regular text"): C's detail rows (body_layer.zig messageGhosts) pushed the rows under the caret's line down in the drawing only, so the mouse, which maps a body row through the row map (Pane.wrapAt), landed a click below them that many rows off (C's report: 'to fix'), and a click on a detail row landed on a line under it; THE FIX: where the detail goes is the step's, as the notice bands are: Messages.detailUnder (the first message naming the caret's line, its lines that fit under that line's last row, in the pane with the keyboard, its body) is made in Messages.collectNotices (the top of update, presented, sync, place) into Pane.ghost_at and ghost_rows (derived: root.zig's kept_out says so), messageGhosts draws from them (it no longer finds the detail itself), and the mouse maps a drawn body row to the row map with Pane.textRow (edit.pointerTextSelection, both the grid's and a body hit's; mouse.dragUpdate's sweep end): a row under the detail is ghost_rows higher, a row of the detail is the line it explains (B1 there puts the caret on that line, the detail kept); B2 and B3 on a word of the detail Exec and Look it as a typed word would be (mouse.zig, body_layer.wordAt reads the word as it is drawn: the body layer's row, else the grid's); a step reads only what its own state makes, so every replica's click lands alike; cost: one more check a pane at collectNotices (none without a live message, the detail only in the pane with the keyboard), nothing a frame; TEST FIRST: body_layer.zig 'a click under a message's detail lands on the row drawn there, a click on the detail on the line it explains, and B2 on a word of the detail runs it' (on the parent: expected 4, found 6, the click on line 5 as drawn landing on line 7's row); NOT DONE: B1's sweep cannot select the detail's text itself (it is no buffer's; the band has the same gap, A's report), a hover underlines the word of the line under the detail row; tui core-test 1036/1205 (169 skipped), process-test 0 of 146 failed
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/Messages.zig')
| -rw-r--r-- | core/Messages.zig | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/Messages.zig b/core/Messages.zig index c9166aed..e995659a 100644 --- a/core/Messages.zig +++ b/core/Messages.zig @@ -920,6 +920,11 @@ pub fn reportFailure(p: *Pardes, id: usize, text: []const u8) void { /// them instead of letting the last one win the row. pub fn collectNotices(p: *Pardes, pane: *Pane, r: Rect) void { pane.notices = bands(p, pane, pane.tag_rows, r); + // A message's detail under the caret's line, where the body draws it + // and a click's row is read (Pane.textRow): the step's, as the bands. + const under = if (r.h > pane.tag_rows) detailUnder(p, pane, p.panes[p.view().active] == pane, r.h - pane.tag_rows) else null; + pane.ghost_at = if (under) |d| d.row else 0; + pane.ghost_rows = if (under) |d| d.rows else 0; // Each band's chip at the right edge, as wide as its own text and a // blank cell either side, the pane's width at most: a click finds it // whether or not a frame has drawn it. An overlay over the body's top @@ -934,6 +939,29 @@ 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. +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; + 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; + 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 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). |
