diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 20:11:51 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 54c14c2e65fe15b097bef11919d6ec8d9fce411a (patch) | |
| tree | a3945447aa94fc20b00ed5cbf655e594b1565d95 /src | |
| parent | 6a49974e56521cf66c9a4d0eb579cd5de949891e (diff) | |
| download | pardes-54c14c2e65fe15b097bef11919d6ec8d9fce411a.tar.gz pardes-54c14c2e65fe15b097bef11919d6ec8d9fce411a.zip | |
An empty column shows its theme's empty_col: white in the acme theme, as acme paints it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/colors.zig | 4 | ||||
| -rw-r--r-- | src/draw.zig | 1 | ||||
| -rw-r--r-- | src/pardes.zig | 19 | ||||
| -rw-r--r-- | src/themes/acme.zig | 2 |
4 files changed, 26 insertions, 0 deletions
diff --git a/src/colors.zig b/src/colors.zig index aeff7b00..401b77f1 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -54,6 +54,8 @@ pub const Theme = struct { column_box: ?[3]u8 = null, column_box_dim: ?[3]u8 = null, border: ?[3]u8 = null, + /// What an empty column shows under its tag; the border fill without it. + empty_col: ?[3]u8 = null, search_bg: ?[3]u8 = null, search_fg: ?[3]u8 = null, diagnostic_error: ?[3]u8 = null, @@ -144,6 +146,7 @@ pub const ChromeTheme = struct { tag_name_fg: [3]u8, tag_active_name_fg: [3]u8, border: [3]u8, + empty_col: [3]u8, search_bg: [3]u8, search_fg: [3]u8, diagnostic_error: [3]u8, @@ -167,6 +170,7 @@ pub const ChromeTheme = struct { .tag_name_fg = th.tag_name_fg orelse th.tag_fg, .tag_active_name_fg = th.tag_active_name_fg orelse (th.tag_name_fg orelse (th.tag_active_fg orelse th.tag_fg)), .border = th.border orelse th.scroll_track, + .empty_col = th.empty_col orelse (th.border orelse th.scroll_track), .search_bg = th.search_bg orelse th.sel_bg, .search_fg = th.search_fg orelse th.sel_fg, .diagnostic_error = th.diagnostic_error orelse (th.fg orelse th.tag_fg), diff --git a/src/draw.zig b/src/draw.zig index b12ab52c..8f2f95f9 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -189,6 +189,7 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { // Separators have their own role; a scrollbar need not frame the page. const whole = s.regions[0].rect; s.fill(whole.x, whole.y, whole.w, whole.h, .{ .bg = .{ .rgb = chrome.border } }); + for (0..p.ncol) |c| if (p.col_n[c] == 0) s.fill(p.col_x[c], p.topBarHeight() + p.columnBarHeight(), p.col_w[c], s.rows -| (p.topBarHeight() + p.columnBarHeight()), .{ .bg = .{ .rgb = chrome.empty_col } }); for (&p.panes, 0..) |*slot, id| { const pane = slot.* orelse continue; diff --git a/src/pardes.zig b/src/pardes.zig index bad512a9..e3f4bb60 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1317,6 +1317,25 @@ test "Placement pardes brings back the old rules, and says so in Config" { try std.testing.expectEqual(config.Runtime.Placement.acme, p.settings.placement); } +test "an empty column shows its theme's empty_col under its tag: acme's white, else the border" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 20 }); + defer p.deinit(); + p.newColumn(0); + tagline.exitHeader(p); + inline for (.{ "acme", "dark" }) |name| { + try std.testing.expect(p.executeBuiltinLine(0, "Theme " ++ name)); + p.chrome_animation.displayed = colors.ChromeTheme.fromTheme(p.theme()); + p.sync(); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + const s = try p.render(arena.allocator()); + const cell = s.at(p.col_x[1] + 3, p.screen_h - 2); + const want = p.chromeTheme().empty_col; + try std.testing.expectEqual(want, cell.style.bg.rgb); + if (std.mem.eql(u8, name, "acme")) try std.testing.expectEqual([3]u8{ 0xff, 0xff, 0xff }, want) else try std.testing.expectEqual(p.chromeTheme().border, want); + } +} + test "dragging a column's only pane to another leaves that column in place, empty" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 32 }); defer p.deinit(); diff --git a/src/themes/acme.zig b/src/themes/acme.zig index d91e626b..693055d6 100644 --- a/src/themes/acme.zig +++ b/src/themes/acme.zig @@ -27,6 +27,8 @@ pub const theme = .{ .lineno = .{ 0x99, 0x99, 0x80 }, .scroll_track = .{ 0x99, 0x99, 0x4c }, .scroll_thumb = .{ 0xff, 0xff, 0xea }, + // acme paints a column with no window white (cols.c:187). + .empty_col = .{ 0xff, 0xff, 0xff }, .palette = .{ .{ 0x00, 0x00, 0x00 }, .{ 0xaa, 0x22, 0x22 }, .{ 0x22, 0x80, 0x22 }, .{ 0x88, 0x66, 0x00 }, .{ 0x22, 0x44, 0xbb }, .{ 0x99, 0x33, 0x99 }, .{ 0x11, 0x88, 0x88 }, .{ 0x55, 0x55, 0x55 }, |
