summaryrefslogtreecommitdiff
path: root/core/draw.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 18:54:18 -0300
committerGabriel Schneider <[email protected]>2026-11-24 19:06:47 -0300
commit7e7d9569a008124cb7ea01b6720a8d5963b0a42f (patch)
tree6e0fd5ec5b6d22d002b1fe76113df63b5aba0f5b /core/draw.zig
parente9f3712ce17f9813ecb15dbf76d46778a49c747d (diff)
downloadpardes-7e7d9569a008124cb7ea01b6720a8d5963b0a42f.tar.gz
pardes-7e7d9569a008124cb7ea01b6720a8d5963b0a42f.zip
walk (pick-ui SPEC §2, §6.1, §6.5, item 1 of the Walk UI line B): a pane is held or reading: Pane.trail (core/Trail.zig: a fixed walk, max_steps 16 of max_text 256 bytes, its steps a union of place, owner, list, search and recipe, `cur` held by walk.zig, in the digest and the dumps) and `held`, set by Keep (a new builtin, `SPC j k`) and by any edit of the file (File.edit, Trail.edited, twins too); a reading pane (a file not held: no output, listing, pager, query or kind) shows Keep after its path in its tag and its tag in the reading tint (a new theme role tag_reading_bg, derived from the page and the search ground, acme the spec's #f3f0cc), under the new setting `Jumps walk|new-pane`, whose default is new-pane until the walk's pickers are in, so every tag, frame and golden is as before (a walk default changes 74 of 102 process goldens and 21 behaviour tests by the Keep word alone); TEST FIRST: Trail.zig "a file's pane is reading ..." and "Keep holds a reading pane ..."; draw.zig's three-row tag test reads its band through tagGround; docs/typ/builtins-tui.json refreshed; core-test 993/1159 (166 skipped), pane-test 183/184, behaviour-test 277/277
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/draw.zig')
-rw-r--r--core/draw.zig16
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);