diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 09:40:17 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 10:28:44 -0300 |
| commit | 8d90edcec1ba432d0f67ecc3a79eb6bf193369ff (patch) | |
| tree | 2adbc108fb6d5076f9dba35afe850d14644ff801 /core/draw.zig | |
| parent | 8959b031dc330b4da21c0e89e0831d6fadbcd757 (diff) | |
| download | pardes-8d90edcec1ba432d0f67ecc3a79eb6bf193369ff.tar.gz pardes-8d90edcec1ba432d0f67ecc3a79eb6bf193369ff.zip | |
TagState, tagline, Band, draw, layout, mouse, Pick, Trail, Core: out of rest a pane's tag stays exactly as at rest and what the keyboard drives hangs under it, the head on the row under the tag's rows, then the band (UX DESIGN M, binding; the user, looking at a picker started in an empty pane whose tag had become `^ ␣ f Find ascii 1/1`: "doesn't it make sense to the search just show below the tagline instead of being search tagline then results?", then "Keep consistent, idk, yes"): for every state the keyboard drives (rolled and unrolled levels, `"`, Help, describe-key, every picker, every text prompt, `:`, rename, code actions) the tag keeps its mark, owner, trail, path, Keep, computed words and own text, its rows and its wrapping, the box alone saying `^` while typing; THE WAY IT WAS: the head (TagState.head) was the tag's text after a cut-down prefix (D1's owner and newest step, tagline.pathPrefix's out-of-rest branch, Trail's `.newest` part), so the path, Keep and the user's text left the screen while you typed, the key cells sat on the tag's row for a level and jumped with it, and a picker's preview in a reading pane would have named the previewed file had the path stayed; THE CHANGE: TagState.head is the head alone, laid out from the tag's text column on rows of its own (Builder's `lead` gone), and TagState.asking the question a tag says, which stays in the tag (UX D13, M1: questions unchanged); tagline.shownTail is the question or the own text in every state, pathPrefix the path in every state (the out-of-rest branch and Trail's `.newest` part, `newest_cells` and the `cut` buffers deleted); a pane a picker previews in names its own file, the one Pick.showText set aside (tagline.named, tagWords, and Trail.reading asking the same file, so its tint, Keep and words are the rest ones); a pane made for the picker (it has no rest) shows its owner's word alone, `‹@pN ›` (M3; P1's reading 2 reversed); Band.covered is the tag's rows at rest, then the head's rows, then the band's, `over` = head + band (no rows the head reused: M4), layout.headRows the head's own rows and floorRows the tag's rows plus the head's and the band's (a head that does not fit borrows from its column as a band does); draw.zig joinBand paints the head's rows as the band layer's first rows (its spans' inks moved there from paintPaneTag, its caret the band layer's cursor), the band's under them, the spines from the head's key cells on its own row; render draws the host's tag with its rest rows; mouse: a press on a tag out of rest ends its state as Esc does and then does what it does at rest (M3; a pane made for a picker goes with it and the press with it), bandPoint reads the head's rows as the band layer's first, and B1 in the head's field puts the field's caret there; edit.zig refuses an edit of a tag only while it asks; RUN (TEST FIRST): five new tests, each failing on the base (M2, 8959b031dc33) and passing now: TagState "out of rest a tag is drawn as at rest, the head hanging under it ..." (a `.list` picker in a reading pane that walked near.txt -> far.txt: the tag's rows cell for cell as at rest but the box, its path far.txt while the body previews near.txt, the head `␣ l Refs ... 1/1` on the next row, its count the row's last cells, the band under it; Esc, the rows as before: failed on the base at the tag text, `near.txt:2 › ␣ l Refs ...`), TagState "the key cells are one thing growing on the row under the tag ..." (`␣`, `␣ f`, `␣ f Find` in the same cells of the row under a two-row tag: failed on the base, `␣` on the tag's row), TagState "a click that gives the keyboard to another pane ends a level ...; one in the level's own tag ends it too, then does what it does there at rest ..." (was "... one in the level's own tag keeps it"; B1 on the tag's own word ends SPC's level and gives the tag the keyboard, B2 on `Wrap` ends Help and toggles wrap: failed on the base, the level kept), Pick "a pane made for a picker has no rest: its tag is its owner's word alone, `‹@pN ›` ..." (B3 on it: the picker ends, the made pane goes, nothing under the press looked at: failed on the base, its tag `␣ f Find ...`), Command ": hangs its field under the tag, which stays as at rest; `:` on the empty field gives the keyboard to that tag's own text right above it ..." (failed on the base, the tag text `: ...`); the expectations that read the head through the tag's text read it from TagState.head now (TagState's testTag, Prompt's and Command's headOf, Pick's headOf; bindings, Messages, lsp/Ask, Trail, Band, draw, views: ~40), and the ones that read a body's first row while a prompt is up read the rows under the head's (Prompt's `/`, `s`, `|` tests, body_layer's current-place test, Ask's rename); views' short-column picker test runs at 15 rows (the head's row is one more covered row: at 12 the band had none left); the process test msg waits for the second reload by the notice row's `×2` (the pane's one line is under the `s` prompt's head now); AND A FAULT THIS MADE VISIBLE: code actions drew their edit's ghost lines from the body's top under a band drawn over it (Pick.previewing was a place's preview alone), so an edit on the first rows of a file was under the band; with the head's row one more covered row, test/behaviour/language_servers.zig's "SPC l a lists the server's code actions ..." failed (`let x = sum(1, 2);` at line 4 under the head and a 4-row band, not on the screen); THE FIX: code actions' body is their preview from the first (UX DESIGN I1: "a picker and code actions (whose body is the preview) keep D6"): Pick.previewing is true for them, so the body starts under the head and the band as a picker's preview does; the behaviour test passes now; GATES (Debug tui, this change): core-test 1166/1340 (174 skipped; M2's gate 1155/1329), shell-test 1381/1384 (3 skipped), behaviour-test 287/287 and --replay 287/287, pane-test 184/185 (1 skipped), term-test 17/17, kitty-test 45/45 (these three before the code-actions fix and two renames), process-test 8 of 149 failed (3 skipped): exactly the goldens with a frame out of rest (find, fsearch, leader, lsp, msg, pipe, selregex, ttyhelp), re-recorded and explained by the next change; the dump does not change (no pane or view field); no frame or perf gate (the user's rule of 2026-11-26); load 4.2 to 14.3
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 | 165 |
1 files changed, 101 insertions, 64 deletions
diff --git a/core/draw.zig b/core/draw.zig index 42396aa1..3caf27ca 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -373,15 +373,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 = tagGround(p, pane, id == v.active) }, .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) { @@ -391,8 +391,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| { @@ -736,8 +736,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"); @@ -749,7 +747,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 @@ -870,9 +868,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); @@ -927,19 +924,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.chromeTheme(); const tab = p.settings.tab; - const columns = @max(band.columns, 1); + const columns = @max(layout.tagCapacity(p, r.w -| TAG_TEXT_INSET), 1); // The walk UI's inks on this tag's ground (colors.Roles, UX DESIGN.md // D4), and on its cursor row's selection. const ground = groundOf(p, pane, active); @@ -953,10 +952,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 = chrome.roles.key }; + style.bold = true; + }, + .dim => style.fg = .{ .rgb = inks.dim }, + .under => style.ul = .single, + .strike => style.strikethrough = true, + .err => style.fg = .{ .rgb = chrome.roles.err }, + .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. @@ -980,20 +1014,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 = chrome.roles.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 = chrome.roles.key }; - if (b < part.row.pre) style.fg = .{ .rgb = if (active) chrome.tag_active_name_fg else chrome.tag_name_fg }; - 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 = on.dim }; - if (b < part.row.kind) style.fg = .{ .rgb = kind }; - for (part.row.keys) |k| if (k == b) { + if (i < part.row.chord) style.fg = .{ .rgb = chrome.roles.key }; + if (i < part.row.pre) style.fg = .{ .rgb = if (active) chrome.tag_active_name_fg else chrome.tag_name_fg }; + 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 = on.dim }; + if (i < part.row.kind) style.fg = .{ .rgb = kind }; + for (part.row.keys) |k| if (k == i) { style.fg = .{ .rgb = chrome.roles.key }; style.bold = true; }; @@ -1001,11 +1035,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 = chrome.roles.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) { @@ -1013,12 +1047,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 = on.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; @@ -1029,6 +1063,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) { + 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 @@ -1085,12 +1131,12 @@ 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; - // Out of rest, the walk UI's text ink (at rest the tag's own, unchanged). - const text_style: CellStyle = if (head == null) tag_style else .{ .fg = .{ .rgb = inks.text }, .bg = .{ .rgb = tag_bg }, .font_role = .tagline }; + // A question in the walk UI's text ink (the tag's own text its own). + const text_style: CellStyle = if (question == null) tag_style else .{ .fg = .{ .rgb = inks.text }, .bg = .{ .rgb = tag_bg }, .font_role = .tagline }; // 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. const top = pane.tag_top; @@ -1112,7 +1158,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; @@ -1127,9 +1173,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..], text_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; @@ -1147,7 +1192,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). @@ -1162,9 +1207,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); @@ -1193,7 +1238,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| { @@ -1213,15 +1258,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; @@ -1880,7 +1916,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; |
