summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Pick.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/Pick.zig b/core/Pick.zig
index 3bc8c858..41a62201 100644
--- a/core/Pick.zig
+++ b/core/Pick.zig
@@ -633,8 +633,9 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head {
if (pk.source == .themes or pk.source == .actions) {
const hint: u32 = @intCast(text.items.len);
try text.appendSlice(arena, if (pk.source == .themes) " ⏎ wear it · esc" else " ⏎ or 1-9 apply it · esc");
- try spans.append(arena, .{ .lo = hint, .hi = @intCast(text.items.len), .style = .dim });
+ // The key cells first: the band's spines hang from them.
for (cells[0..ncells]) |c| try spans.append(arena, .{ .lo = c[0], .hi = c[1], .style = .key });
+ try spans.append(arena, .{ .lo = hint, .hi = @intCast(text.items.len), .style = .dim });
return .{ .text = text.items, .spans = spans.items, .cells = @intCast(ncells), .caret = caret };
}
// The second row: the spines go on through it from the key cells,
@@ -2231,6 +2232,11 @@ test "the themes picker marks the theme in use: `in use` at its row's right end
for (" tt") |c| p.update(.{ .key = .{ .cp = c } });
const s = &p.view().tag_state;
try std.testing.expectEqual(@as(u16, @intCast(was)), s.rows.at);
+ // The band's spines hang from the head's first `cells` spans: its key
+ // cells (`␣ t`), never its dim hint.
+ const h = (try head(p, a, pane)).?;
+ try std.testing.expectEqual(@as(u8, 2), h.cells);
+ for (h.spans[0..h.cells]) |span| try std.testing.expectEqual(TagState.Style.key, span.style);
const Find = struct {
fn row(band: Band, text: []const u8) ?Band.Row {
for (band.steps[0..band.nsteps]) |step| for (step.rows) |r| if (std.mem.eql(u8, r.text, text)) return r;