diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 12:44:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 13:02:49 -0300 |
| commit | 51f211d694beff9a389ab519f2286cef077adb81 (patch) | |
| tree | 2df93ee551f2820011f6f67b32f5131fbd927888 /core/draw.zig | |
| parent | 3d60aa05ec1a6f9ed535186be6c6c2850c71b24d (diff) | |
| parent | d7b01dfc187244b6613a954d82552675d3bd2689 (diff) | |
| download | pardes-51f211d694beff9a389ab519f2286cef077adb81.tar.gz pardes-51f211d694beff9a389ab519f2286cef077adb81.zip | |
merge (M3): tonplrtr 3d60aa05ec1a (L2a: the tags, grips, band and notice row drawn from the chrome, the old ChromeTheme, Roles and Grounds views deleted, part H's inks, the path dim while a pane previews another file; M2's wxvzvomn, dump.load resolves the chrome; FP's PDF preview leak, the exec rerun's spawn stop, ABI 3.4's PDF hits) with rppqvrqx d7b01dfc1872 (W9, walkui UX DESIGN part O on W5's part M: the tag stays at rest and the head hangs under it as the band's first row, a picker hangs under the tag of the pane with the keyboard, the mouse never ends it, TagState.waits, Pick.tall, the act/source row gone), resolved: THE CODE: core/draw.zig joinBand draws W5/W9's layout with L2a's inks: the head (TagState.head) and the band from `p.chrome().on(focus or plain)` (its keys `inks.key`, its error `inks.severity[0]`, its dim and rule the ground's), the band's rows' keys, chords, `pre` (the name tint `chrome.name[g]`), dim, kind and matched letters as L2a drew them, W9's loop variable `i` kept; paintPaneTag keeps W9's question in the tag (TagState.asking) and L2a's single tag ink (W9's out-of-rest `text_style` gone with L2a's: a question's text and the tag's own were the same ink once Roles went), and draws the computed words in the words' ink whenever the tag does not ask (L2a's `head == null and !asks`: out of rest the tag is the rest tag now, so its words are the rest words); render's head-and-band gutter (W9's `at.tag`) on L2a's ground; draw's key-ink test reads `p.chrome().on(.focus)` and W9's `? help`; core/TagState.zig's W5 test "out of rest a tag is drawn as at rest ..." (renamed: "... but the box and its path's ink, the path its own and dim ...") lets the path's cells differ in their ink alone, the dim ink, the dimmed text ending `/far.txt`: L2a's zrxurkop dims a tag's path while its body previews another file (the coordinator's ruling, UX DESIGN M7.2), which the test, written before it on W5's tree, read as a moved cell (core-test failed it at TagState.zig:1741 on the merge as jj made it); THE GOLDENS: process-test -- --update re-recorded all 103 golden cases, the 102 golden files (every one with a frame out of rest among them), and moved exactly the two in conflict, fsearch and selregex, each now W9's text rows byte for byte (gdiff.py: no snap row differs from W9's) and L2a's inks on them; read cell by cell (.scratch/walkui/M3/gpairs.py: each cell where the merge differs from W9's recording, and whether L2a made that same move base -> L2a): selregex's four style blocks and fsearch's one move only by L2a's classes: the window and column rows to the page (#b2c3b8 on #1d2824 -> #788079 on #0d1410, the active column's #becfc4 on #314738 too), the reading pane's tint #2c2c0f gone to the focus ground #394440 under the rest tag (full ink #becfc4 -> #cadbd0, the name tint #ecc8f2 kept, its computed words and the blanks after them #becfc4 -> #a1b1a8, the word ink) and under the head on the row below it (text #cadbd0, keys #bada9d -> #add38a bold, dim #79836f -> #8e9d94), a focused reading grip's glyph #000000 -> mode_glyph #06779d, the rail's current tick to the current hit #917a53, a command pane's computed words #b2c3b8 -> #819188; the only pairs L2a's own recordings never made are the same ink moves on cells W9 newly drew there: the head row's gutter cells on the tag's ground (`d` and the body's #e5eee5 on #2c2c0f -> #394440: render's gutter fill on L2a's ground), and fsearch's rest tag on the reading pane W9 moved to row 16 (name tint and words as selregex's); no row neither side explains; the 100 other golden files re-recorded byte for byte as the merge had them (L2a's 36 as L2a recorded them, W9's six text-only goldens as W9 did); GATES (Debug tui, on this change): core-test 1163/1338 (175 skipped; L2a's tree 1160/1335, W9's three new tests), shell-test 1386/1389 (3 skipped), process-test 0 of 103 failed with --update (2 moved, read above); the rest of the gates on the stack's top; load 1.2 to 2.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/draw.zig')
| -rw-r--r-- | core/draw.zig | 174 |
1 files changed, 106 insertions, 68 deletions
diff --git a/core/draw.zig b/core/draw.zig index 0946978f..648808aa 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -344,15 +344,15 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { s.body_layers[id].rows = 0; try renderPane(p, s, arena, pane, v.rects[id], id, id == v.active); } - // A tag out of rest after every body (UX DESIGN I1): its head and its - // band past its own rows are drawn over the top rows of its body, - // which stay where they were; beside them the grip's column on the - // tag's ground, and a caret under them hidden until rest. + // A tag out of rest after every body (UX DESIGN I1, M2): drawn as at + // rest, its head and band hanging under it over the top rows of its + // body, which stay where they were; beside them the grip's column on + // the tag's ground, and a caret under them hidden until rest. if (TagState.hostOf(p)) |id| if (p.panes[id]) |pane| if (v.rects[id].w > config.GUTTER and v.rects[id].h > 0) { const r = v.rects[id]; const at = pardes.Band.covered(p, pane, id); - const y = p.tagTop(pane, r) + pane.tag_rows; - const rows = @min(at.over, r.h -| pane.tag_rows); + const y = p.tagTop(pane, r) + at.tag; + const rows = @min(at.over, r.h -| at.tag); if (rows > 0) { s.fill(r.x, y, config.GUTTER, rows, .{ .bg = .{ .rgb = chrome.on(if (id == v.active) .focus else .plain).ground }, .font_role = .tagline }); if (s.cursor) |c| if (c.x >= r.x and c.x < r.x + r.w and c.y >= y and c.y < y + rows) { @@ -362,8 +362,8 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { s.body_layers[id].cursor = null; }; } - try joinPaneTag(p, s, arena, pane, r, id, id == v.active, at.text); - if (at.band > 0) try joinBand(p, s, arena, pane, r, id, id == v.active, at); + try joinPaneTag(p, s, arena, pane, r, id, id == v.active, at.tag); + if (at.over > 0) try joinBand(p, s, arena, pane, r, id, id == v.active, at); }; // Each notice once, as a tag layer, and the grid's chip a copy of it. for (s.regionList()) |region| { @@ -500,8 +500,9 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: // In window mode the box holds the pane's letter instead of its mode. const label: ?u8 = if (p.view().window_pick != null) layout.windowLabel(p, id) else null; // A tag in a typing state is typed in: its box says so (walk UI SPEC - // §3.2), whatever the body's mode. - const typing = p.view().tag_state.kind != .rest and TagState.hostOf(p) == id; + // §3.2), whatever the body's mode; not while it waits for the keyboard + // (UX DESIGN O2). + const typing = p.view().tag_state.kind != .rest and !p.view().tag_state.waits and TagState.hostOf(p) == id; s.set(r.x, tag_y, if (label) |*letter| @as(*const [1]u8, letter) else if (typing) config.tag_insert else switch (pane.body.mode) { .normal => config.tag_normal, .insert => config.tag_insert, @@ -717,8 +718,6 @@ fn joinCells(s: *Surface, x: u16, y: u16, cells: []const Cell, from: usize, w: u } fn tagTintRange(p: *const Pardes, pane: *const Pane, tag: []const u8, prefix_len: usize) ?struct { lo: usize, hi: usize } { - // Out of rest no name is shown (UX D1). - if (pardes.Trail.outOfRest(p, pane)) return null; if (pane.isTerminal()) { // `tag` is the first row; a prefix longer than it ran to a second. var words = std.mem.tokenizeAny(u8, tag[@min(prefix_len, tag.len)..], " \t\r\n"); @@ -730,7 +729,7 @@ fn tagTintRange(p: *const Pardes, pane: *const Pane, tag: []const u8, prefix_len return null; } var start: usize = tagline.nameAt(p, pane); - const name = if (pane.file) |file| + const name = if (tagline.named(p, pane)) |file| if (pane.prompt == .name) pane.input.own orelse file.path else file.path else if (pane.addon) |k| blk: { // A kind's tag may put its words before the path (an image's @@ -850,9 +849,8 @@ fn renderHeaderLayer(p: *Pardes, layer: *pardes.Layer, kind: TagKind, id: u16, v } /// A pane's tag's `rows` text rows (MAX_TAG_ROWS at most; out of rest its -/// head's, Band.covered, past its own rows over its body), painted once -/// into their layer, a row to a line, and copied into the grid; the grid's -/// caret where the layer has it. +/// rows at rest, Band.covered), painted once into their layer, a row to a +/// line, and copied into the grid; the grid's caret where the layer has it. fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize, active: bool, rows: u16) !void { const v = p.view(); const capacity = layout.tagCapacity(p, r.w -| TAG_TEXT_INSET); @@ -909,19 +907,21 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r } } -/// The band under pane `id`'s tag text (Band.zig), its `drawn.band` rows -/// under the head's `drawn.text`, painted once into its layer at the -/// tagline's pitch, a row to a line, and copied into the grid: the spines -/// and steps in the tag's tint, the keys in the key ink, the cursor's row -/// tinted as a selection. +/// The head and the band under pane `id`'s tag (UX DESIGN M2): the head's +/// `drawn.head` rows (TagState.head: its keys, the level or the field and +/// its caret, the count, the hints), then the band's `drawn.band` +/// (Band.zig), painted once into their layer at the tagline's pitch, a row +/// to a line, and copied into the grid: the spines and steps in the tag's +/// tint, the keys in the key ink, the cursor's row tinted as a selection. fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize, active: bool, drawn: pardes.Band.Covered) !void { const layer = &s.tag_layers[pardes.BAND_LAYER]; - const rows = drawn.band; + const rows = drawn.over; if (r.w <= TAG_TEXT_INSET) return; - const band = (try pardes.Band.of(p, arena, pane, id)) orelse return; + const head = (try TagState.head(p, arena, pane)) orelse return; + const band = try pardes.Band.of(p, arena, pane, id); const chrome = p.chrome(); const tab = p.settings.tab; - const columns = @max(band.columns, 1); + const columns = @max(layout.tagCapacity(p, r.w -| TAG_TEXT_INSET), 1); // The inks of its tag's ground, focused or not, whatever its mode // (DESIGN.md B6, G1'), and of its cursor row's selection, a ground of // its own (B1.3). @@ -933,10 +933,45 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R const storage = try arena.alloc(Cell, @as(usize, columns) * rows); @memset(storage, .{}); var t: Surface = .{ .cols = columns, .rows = rows, .cells = storage, .tab = tab }; - for (0..rows) |y| { - const row: u16 = @intCast(y); - t.fill(0, row, columns, 1, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); - const ln = try band.line(arena, tab, row); + t.fill(0, 0, columns, rows, .{ .bg = .{ .rgb = bg }, .font_role = .tagline }); + // The head's rows, as it laid itself out at the tag's width (UX D2, D3). + const shown = try tagline.wrapTag(tab, arena, head.text, columns); + var lines: [MAX_TAG_ROWS][]const u8 = @splat(""); + var split = std.mem.splitScalar(u8, shown.text, '\n'); + for (lines[0..drawn.head], 0..) |*line, y| { + line.* = split.next() orelse break; + _ = t.print(0, @intCast(y), columns, line.*, .{ .fg = .{ .rgb = fg }, .bg = .{ .rgb = bg }, .font_role = .tagline }); + } + // Its keys in the key ink, its dimmed, underlined and struck words + // (TagState.Span), over whichever rows they wrapped onto. + for (head.spans) |span| { + const a = modal.positionAt(shown.text, shown.fromReal(span.lo)); + const b = modal.positionAt(shown.text, shown.fromReal(span.hi)); + var row = a.row; + while (row <= b.row and row < drawn.head) : (row += 1) { + const line = lines[row]; + var col = panes.File.rawDisplayCol(tab, line, @min(if (row == a.row) a.col else 0, line.len)); + const end = panes.File.rawDisplayCol(tab, line, @min(if (row == b.row) b.col else line.len, line.len)); + while (col < end and col < columns) : (col += 1) { + const style = &t.at(@intCast(col), @intCast(row)).style; + switch (span.style) { + .key => { + style.fg = .{ .rgb = inks.key }; + style.bold = true; + }, + .dim => style.fg = .{ .rgb = inks.dim }, + .under => style.ul = .single, + .strike => style.strikethrough = true, + .err => style.fg = .{ .rgb = inks.severity[0] }, + .rule => style.fg = .{ .rgb = inks.rule }, + } + } + } + } + // The band's rows under the head's. + if (band) |b| for (0..drawn.band) |y| { + const row: u16 = @intCast(drawn.head + y); + const ln = try b.line(arena, tab, @intCast(y)); _ = t.print(0, row, columns, ln.text, .{ .fg = .{ .rgb = fg }, .bg = .{ .rgb = bg }, .font_role = .tagline }); // The spines and the rules between steps in the rule ink; a row's // `▶` (the cursor) and `•` (marked) in the key ink. @@ -964,20 +999,20 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R t.tint(part.col, row, end - part.col, selected.ground, selected.text); } var c = part.col; - var b: usize = 0; - while (b < part.row.text.len and c < end) : (c += 1) { - const next = modal.nextGrapheme(part.row.text, b); + var i: usize = 0; + while (i < part.row.text.len and c < end) : (c += 1) { + const next = modal.nextGrapheme(part.row.text, i); const style = &t.at(c, row).style; - if (b < part.row.key) { + if (i < part.row.key) { style.fg = .{ .rgb = key }; style.bold = true; } // A chord (Help's `SPC h t`): keys, at the text's weight. - if (b < part.row.chord) style.fg = .{ .rgb = key }; - if (b < part.row.pre) style.fg = .{ .rgb = chrome.name[@intFromEnum(g)] }; - if (part.row.dim or (b >= part.row.pre and b < part.row.pre + part.row.faint) or (b >= part.row.quiet[0] and b < part.row.quiet[1])) style.fg = .{ .rgb = dim }; - if (b < part.row.kind) style.fg = .{ .rgb = inks.kind }; - for (part.row.keys) |k| if (k == b) { + if (i < part.row.chord) style.fg = .{ .rgb = key }; + if (i < part.row.pre) style.fg = .{ .rgb = chrome.name[@intFromEnum(g)] }; + if (part.row.dim or (i >= part.row.pre and i < part.row.pre + part.row.faint) or (i >= part.row.quiet[0] and i < part.row.quiet[1])) style.fg = .{ .rgb = dim }; + if (i < part.row.kind) style.fg = .{ .rgb = inks.kind }; + for (part.row.keys) |k| if (k == i) { style.fg = .{ .rgb = key }; style.bold = true; }; @@ -985,11 +1020,11 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R // A matched letter: the match ink, bold, on the row's own // ground (never a ground of its own: on the cursor row's // selection one vanished). - for (part.row.marks) |m| if (m == b) { + for (part.row.marks) |m| if (m == i) { style.fg = .{ .rgb = if (part.row.on) selected.match else inks.match }; style.bold = true; }; - b = next; + i = next; } // Its meta, right-aligned in the part (Band.line), dim. if (pardes.Band.metaShown(tab, part.row, part.width) and part.col + part.width <= columns) { @@ -997,12 +1032,12 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R for (part.col + part.width - meta..part.col + part.width) |x| t.at(@intCast(x), row).style.fg = .{ .rgb = dim }; } } - } + }; const count = @as(usize, columns) * rows; if (layer.cells.len != count) layer.cells = try p.gpa.realloc(layer.cells, count); @memcpy(layer.cells, storage); - // Under the head's rows, over the body's top ones (Band.covered). - const y0 = p.tagTop(pane, r) + drawn.text; + // Under the tag's rows, over the body's top ones (Band.covered). + const y0 = p.tagTop(pane, r) + drawn.tag; layer.kind = .band; layer.id = @intCast(id); layer.serial = pane.serial; @@ -1013,6 +1048,18 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R layer.bg = bg; layer.cursor = null; for (0..rows) |y| joinCells(s, r.x + TAG_TEXT_INSET, y0 + @as(u16, @intCast(y)), storage[y * columns ..][0..columns], 0, r.w - TAG_TEXT_INSET, .{ .rgb = fg }); + // A head typed in: its caret a bar at the field's, the keyboard's + // where the pane has it. + if (head.caret) |c| if (active and !p.view().tag_state.waits) { + const at = modal.positionAt(shown.text, shown.fromReal(c)); + if (at.row < drawn.head) { + const col = panes.File.rawDisplayCol(tab, lines[at.row], @min(at.col, lines[at.row].len)); + if (col < columns) { + layer.cursor = .{ .x = @intCast(col), .y = @intCast(at.row), .bar = true }; + if (col < r.w - TAG_TEXT_INSET) s.cursor = .{ .x = r.x + TAG_TEXT_INSET + @as(u16, @intCast(col)), .y = y0 + @as(u16, @intCast(at.row)), .bar = true }; + } + } + }; } /// Bytes `lo` to `hi` of a tag's text in `ink`, over whichever of its @@ -1058,9 +1105,9 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, .font_role = .tagline, }); const whole = try tagline.tagText(p, arena, pane); - // Out of rest, the head in place of the tag's own text (TagState). - const head = try TagState.head(p, arena, pane); - const tail = if (head) |h| h.text else tagline.curTail(pane); + // A question in place of the tag's own text (TagState.asking). + const question = try TagState.asking(p, arena, pane); + const tail = if (question) |h| h.text else tagline.curTail(pane); const prefix_len = whole.len - tail.len; // A row per line shown, from `tag_top`: the tag's first line carries // the prefix, the rest are the tag's own text alone. @@ -1083,7 +1130,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, const at = modal.positionAt(shown.text, shown.fromReal(tagline.nameAt(p, pane) + @as(usize, @intCast(@max(0, pane.input.cur_col))))); if (at.row < top or at.row >= top + rows) break :caret null; break :caret .{ .row = at.row - top, .at = @min(lines[at.row - top].len, at.col) }; - } else if (pane.focus == .tag and pane.prompt == .none and head == null) caret: { + } else if (pane.focus == .tag and pane.prompt == .none and question == null) caret: { const real = modal.offsetAt(whole, .{ .row = @intCast(@max(0, pane.tag.cur_row)), .col = @intCast(@max(0, pane.tag.cur_col)) }); const at = modal.positionAt(shown.text, shown.fromReal(real)); if (at.row < top or at.row >= top + rows) break :caret null; @@ -1098,9 +1145,8 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, _ = s.print(tx, tag_y + @as(u16, @intCast(row)), tw, line[start..], tag_style); } // The pane's progress at its first row's right end, where the row has - // room for it (SPEC §10.2); out of rest the head's right block is - // there (UX D1). - if (top == 0 and rows > 0 and !pardes.Trail.outOfRest(p, pane)) for (p.messages.live[0..p.messages.live_len]) |*said| { + // room for it (SPEC §10.2). + if (top == 0 and rows > 0) for (p.messages.live[0..p.messages.live_len]) |*said| { if (said.kind != .progress or said.pane != pane.serial) continue; var buf: [Messages.LoggedMessage.cap + 8]u8 = undefined; const text = std.fmt.bufPrint(&buf, "{s} {s}", .{ Messages.Kind.progress.glyph(), said.words() }) catch break; @@ -1113,8 +1159,8 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, // wrapped onto. const first_line = whole[0 .. std.mem.indexOfScalar(u8, whole, '\n') orelse whole.len]; // Its computed words (UX K'1), between its path and the user's text, - // at rest and not asking: the words' ink, quieter than the full one. - if (head == null and !TagState.asks(p, pane)) { + // not asking: the words' ink, quieter than the full one. + if (question == null) { const words = tagline.computedWords(pane); const end = prefix_len -| 1; inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, end -| words.len, @min(end, first_line.len), inks.word, false); @@ -1134,7 +1180,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, // `+N` too; the word n walks underlined in the key ink (UX D8). const ahead = tagline.forwardSpan(p, pane); if (ahead[0] < ahead[1]) inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, ahead[0], @min(ahead[1], first_line.len), inks.dim, false); - if (pane.file != null and pane.trail.n > 0 and !pardes.Trail.outOfRest(p, pane)) { + if (pane.file != null and pane.trail.n > 0) { const kept = tagline.folded(p, pane).whole; const t = &pane.trail; // Each run of folded places' `+N` (UX L'1: words never fold). @@ -1149,9 +1195,9 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, } // A search word its places no longer light, dimmed (Prompt.zig). if (pardes.Prompt.unlit(p, pane)) |span| inkTag(p, s, shown, lines[0..rows], top, tx, tag_y, tw, span[0], @min(span[1], first_line.len), inks.dim, false); - // The head's keys in the key ink, its dimmed, underlined and struck - // words (TagState.Span), over whichever rows they wrapped onto. - if (head) |h| for (h.spans) |span| { + // A question's keys in the key ink, its dimmed words (TagState.Span), + // over whichever rows they wrapped onto. + if (question) |h| for (h.spans) |span| { const a = modal.positionAt(shown.text, shown.fromReal(prefix_len + span.lo)); const b = modal.positionAt(shown.text, shown.fromReal(prefix_len + span.hi)); var row = @max(a.row, top); @@ -1180,7 +1226,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, }; // The tag's own selections, while it has the keyboard, a line at a // time. A range of one grapheme is the block cursor, not a selection. - if (pane.focus == .tag and head == null) { + if (pane.focus == .tag and question == null) { var ranges: [Text.max_selections]modal.Selection = undefined; const got = pane.tag.ranges(whole, 0, &ranges); for (ranges[0..got.n]) |range| { @@ -1200,15 +1246,6 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, } } } - // A head typed in: its caret a bar at the field's. - if (head) |h| if (h.caret) |c| if (active) { - const at = modal.positionAt(shown.text, shown.fromReal(prefix_len + c)); - if (at.row >= top and at.row < top + rows) { - const line = lines[at.row - top]; - const col = panes.File.rawDisplayCol(p.settings.tab, line, @min(at.col, line.len)); - if (col < tw) s.cursor = .{ .x = tx + @as(u16, @intCast(col)), .y = tag_y + @as(u16, @intCast(at.row - top)), .bar = true }; - } - }; // the caret: bar while typing, block in normal mode (same rule as a body) if (caret) |at| { const col = panes.File.rawDisplayCol(p.settings.tab, lines[at.row], at.at) -| pane.tag_scroll; @@ -1851,7 +1888,7 @@ test "a tag out of rest draws its keys bold in the key ink and its hint in the d defer frame.deinit(); const a = frame.allocator(); const inks = p.chrome().on(.focus); - // SPC's level rolled, after its delay: `␣ ▸ … l lsp… … ↓ unroll · ? help`. + // SPC's level rolled, after its delay: `␣ ▸ … l lsp… … ? help`. p.clock.now_ns = 5 * std.time.ns_per_s; p.clock.stepped_ns = p.clock.now_ns; p.update(.{ .key = .{ .cp = ' ' } }); @@ -1860,7 +1897,8 @@ test "a tag out of rest draws its keys bold in the key ink and its hint in the d p.sync(); const s = try p.render(a); const r = p.view().rects[p.view().active]; - const row = s.cells[@as(usize, r.y) * s.cols ..][0 .. @as(usize, s.cols) * pardes.Band.covered(p, pane, p.view().active).text]; + const drawn = pardes.Band.covered(p, pane, p.view().active); + const row = s.cells[@as(usize, r.y + drawn.tag) * s.cols ..][0 .. @as(usize, s.cols) * drawn.head]; const Row = struct { fn find(cells: []const Cell, word: []const u8) ?usize { var at: usize = 0; @@ -1872,7 +1910,7 @@ test "a tag out of rest draws its keys bold in the key ink and its hint in the d return null; } }; - const hint = Row.find(row, "unroll").?; + const hint = Row.find(row, "? help").?; try std.testing.expectEqual(Color{ .rgb = inks.dim }, row[hint].style.fg); for (row) |cell| try std.testing.expect(!cell.style.dim); var keys: usize = 0; |
