diff options
Diffstat (limited to 'core/draw.zig')
| -rw-r--r-- | core/draw.zig | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/core/draw.zig b/core/draw.zig index ff76aa75..f00a7583 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -454,7 +454,7 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: // its ring. A pixel shell draws the ring (gui.zig gripDecor); a grid, // which cannot, marks dirty in the grip's second cell with a bold `*` // on the dirty colour, a cue that survives any palette. - const band = if (active) chrome.tag_active_bg else chrome.tag_bg; + const band = tagGround(p, pane, active); const dirty = tagline.dirty(pane); const box_bg = gripBg(p, active); const box_style: CellStyle = .{ @@ -776,7 +776,7 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r layer.cols = columns; layer.rows = rows; layer.context_rows = 0; - layer.bg = if (v.window_pick == id) p.theme().sel_bg else if (active) chrome.tag_active_bg else chrome.tag_bg; + layer.bg = if (v.window_pick == id) p.theme().sel_bg else tagGround(p, pane, active); layer.cursor = if (v.header != null) null else if (temporary.cursor) |cursor| .{ .x = cursor.x - TAG_TEXT_INSET, .y = cursor.y, .bar = cursor.bar } else @@ -793,6 +793,14 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r } } +/// A pane's tag's ground: a reading pane's tint (its focus is its grip's), +/// else the focused tag's or the tag's. +fn tagGround(p: *Pardes, pane: *const Pane, active: bool) [3]u8 { + const chrome = p.chromeTheme(); + if (pardes.Trail.reading(p, pane)) return chrome.tag_reading_bg; + return if (active) chrome.tag_active_bg else chrome.tag_bg; +} + fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: Rect, id: usize, active: bool) !void { const th = p.theme(); const chrome = p.chromeTheme(); @@ -802,7 +810,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, const rows = pane.tag_rows; const page_rgb = th.bg orelse th.tag_bg; // Focus is visible along the tag without changing its live text grid. - const tag_bg = if (active) chrome.tag_active_bg else chrome.tag_bg; + const tag_bg = tagGround(p, pane, active); const tag_fg = if (active) chrome.tag_active_fg else chrome.tag_fg; const tag_style: CellStyle = .{ .fg = .{ .rgb = tag_fg }, .bg = .{ .rgb = tag_bg }, .font_role = .tagline }; // Padding belongs to the same font row but keeps its default ink: a @@ -1046,7 +1054,7 @@ test "a tag of three rows has its grip on the first, and band under it that stil const top = p.tagTop(pane, r); try std.testing.expect(pane.tag_rows >= 3); const chrome = p.chromeTheme(); - const band = chrome.tag_active_bg; + const band = tagGround(p, pane, true); for (0..config.GUTTER) |dx| { const x = r.x + @as(u16, @intCast(dx)); try std.testing.expectEqual(Color{ .rgb = chrome.box }, s.at(x, top).style.bg); |
