summaryrefslogtreecommitdiff
path: root/core/draw.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/draw.zig')
-rw-r--r--core/draw.zig40
1 files changed, 21 insertions, 19 deletions
diff --git a/core/draw.zig b/core/draw.zig
index 3d4c47b6..822bfb67 100644
--- a/core/draw.zig
+++ b/core/draw.zig
@@ -919,17 +919,15 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R
const rows = drawn.band;
if (r.w <= TAG_TEXT_INSET) return;
const band = (try pardes.Band.of(p, arena, pane, id)) orelse return;
- const chrome = p.chromeTheme();
+ const chrome = p.chrome();
const tab = p.settings.tab;
const columns = @max(band.columns, 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: colors.TagGround = if (pardes.Trail.reading(p, pane)) (if (active) .reading_focused else .reading) else if (active) .focused else .plain;
- const inks = chrome.roles.on(ground);
- const selected = chrome.roles.selectedOn(ground);
- // A symbol's kind mark (colors.Chrome.Inks.kind): held on this tag's
- // ground and on its cursor row's selection.
- const kind = p.chrome().on(if (active) .focus else .plain).kind;
+ // 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).
+ const g: colors.Chrome.Ground = if (active) .focus else .plain;
+ const inks = chrome.on(g);
+ const selected = &inks.selection;
const bg = inks.ground;
const fg = inks.text;
const storage = try arena.alloc(Cell, @as(usize, columns) * rows);
@@ -948,17 +946,21 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R
const next = modal.nextGrapheme(ln.text, at);
const glyph = ln.text[at..next];
if (std.mem.eql(u8, glyph, "│")) t.at(col, row).style.fg = .{ .rgb = inks.rule };
- if (std.mem.eql(u8, glyph, "▶") or std.mem.eql(u8, glyph, "•")) t.at(col, row).style.fg = .{ .rgb = chrome.roles.key };
+ if (std.mem.eql(u8, glyph, "▶") or std.mem.eql(u8, glyph, "•")) t.at(col, row).style.fg = .{ .rgb = inks.key };
at = next;
}
for (ln.parts) |part| {
const end = @min(columns, part.col + part.width);
- const on = if (part.row.on) selected else inks;
+ const dim = if (part.row.on) selected.dim else inks.dim;
+ const key = if (part.row.on) selected.key else inks.key;
// The cursor's row across its step's width, its lead too (UX
// D5), the lead's `▶` keeping the key ink (D4).
if (part.row.on and part.col < end) {
const lead = part.col -| 2;
t.tint(lead, row, part.col - lead, selected.ground, null);
+ for (lead..part.col) |x| if (std.meta.eql(t.at(@intCast(x), row).style.fg, Color{ .rgb = inks.key })) {
+ t.at(@intCast(x), row).style.fg = .{ .rgb = selected.key };
+ };
t.tint(part.col, row, end - part.col, selected.ground, selected.text);
}
var c = part.col;
@@ -967,16 +969,16 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R
const next = modal.nextGrapheme(part.row.text, b);
const style = &t.at(c, row).style;
if (b < part.row.key) {
- style.fg = .{ .rgb = chrome.roles.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 = 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 };
+ 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) {
- style.fg = .{ .rgb = chrome.roles.key };
+ style.fg = .{ .rgb = key };
style.bold = true;
};
if (part.row.under) style.ul = .single;
@@ -984,7 +986,7 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R
// ground (never a ground of its own: on the cursor row's
// selection one vanished).
for (part.row.marks) |m| if (m == b) {
- style.fg = .{ .rgb = chrome.roles.match };
+ style.fg = .{ .rgb = if (part.row.on) selected.match else inks.match };
style.bold = true;
};
b = next;
@@ -992,7 +994,7 @@ fn joinBand(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: R
// 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) {
const meta: u16 = @intCast(panes.File.displayWidth(tab, part.row.meta));
- for (part.col + part.width - meta..part.col + part.width) |x| t.at(@intCast(x), row).style.fg = .{ .rgb = on.dim };
+ for (part.col + part.width - meta..part.col + part.width) |x| t.at(@intCast(x), row).style.fg = .{ .rgb = dim };
}
}
}