diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 13:57:28 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 0de2e7f04977b22df3f7b6ab1690eb8a6c905cd4 (patch) | |
| tree | 0b8b240052c9599d965817336ae46aa692ac5b88 /src/body_layer.zig | |
| parent | 29e734cf91ffe5f4cca8b40a54aad91fff464a82 (diff) | |
| download | pardes-0de2e7f04977b22df3f7b6ab1690eb8a6c905cd4.tar.gz pardes-0de2e7f04977b22df3f7b6ab1690eb8a6c905cd4.zip | |
Paint tags, notices and headers once, and join them into the grid
A pane's tag rows, each notice chip and the workspace and column tags are
painted once, as their tag layers, and the grid's cells for them are copies
of those layers (joinCells): the second paint of every tag, the grid's own
notice pass and paintHeaders' grid text, hover, selection and caret are
gone, and so is renderTagLayers. The grid's caret for a tag, a header or a
prompt is the layer's, projected to grid columns. A wide glyph cut by the
edge of the copy is left as the band's blank, as the grid's print never drew
half of one (a test proves it, and fails without the re-clip).
Where the two copies disagreed, the grid's behaviour is kept, so every
snapshot golden is byte-identical:
- a notice highlighted the hovered word only as a layer; now it never does;
- a column tag's hover was suppressed during a column move only on the
grid; now in both;
- a header under edit showed the hovered word only on the grid; now in
both, under the selection;
- a notice's leading padding carried the band's ink only as a layer; the
grid copy keeps it blank;
- a notice whose band is wider in tagline pitch than in grid cells (a GUI
core) now shows the band's right end on the grid, where its text is, and
its prompt caret there.
A sweep begun on a tag and dragged into the body still shows on the body
rows it crossed, on the grid only (paintPointerSelection's from_row).
Diffstat (limited to 'src/body_layer.zig')
| -rw-r--r-- | src/body_layer.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/body_layer.zig b/src/body_layer.zig index 2b6ae773..e1a45058 100644 --- a/src/body_layer.zig +++ b/src/body_layer.zig @@ -228,6 +228,8 @@ pub fn paintPointerSelection( tag_y: u16, body_y: u16, sl: Pane.Sel, + /// Rows of the selection above this are left alone. + from_row: u16, bg: [3]u8, fg: ?[3]u8, ) void { @@ -238,7 +240,7 @@ pub fn paintPointerSelection( const c1 = @max(0, @max(sl.c0, sl.c1)); var row: u16 = 0; while (row < r.h) : (row += 1) { - if (@as(i32, row) < r0 or @as(i32, row) > r1) continue; + if (@as(i32, row) < r0 or @as(i32, row) > r1 or row < from_row) continue; const sy = if (row < pane.tag_rows) tag_y + row else body_y + row - pane.tag_rows; // File line numbers occupy a gutter only in the body. The tag is // row zero in Sel space and starts at its real first text cell. @@ -363,7 +365,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane if (preview.file_word) |word| panes.File.paintWordSelection(p, s, pane, r, word.row, word.lo, word.hi, preview_bg) else if (preview.sel) |sel| - paintPointerSelection(p, s, pane, r, tx, tw, tag_y, body_y, sel, preview_bg, null); + paintPointerSelection(p, s, pane, r, tx, tw, tag_y, body_y, sel, 0, preview_bg, null); } } const modal_hover = if (p.look_hover_preview) |preview| @@ -376,7 +378,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane // A select sweep over the tag is the tag's selection, painted there // in the tag's own selection colours. if (b == pardes.sel_slot and @min(sl.r0, sl.r1) < pane.tag_rows) continue; - paintPointerSelection(p, s, pane, r, tx, tw, tag_y, body_y, sl, sel_btn[b], th.sel_fg); + paintPointerSelection(p, s, pane, r, tx, tw, tag_y, body_y, sl, 0, sel_btn[b], th.sel_fg); } // modal line selection (helix `x`): whole body rows, normal mode only if ((pane.body.mode == .normal or modal_hover) and pane.body.msel.active) { |
