diff options
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 51ec6bbf..45157dd3 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -7,7 +7,6 @@ const posix = std.posix; /// libc: pipes and fcntl for the window's wakes, and a test harness's capture files written from the render thread. const libc = std.c; const vaxis = @import("vaxis"); // test modes only: the stdin escape-seq parser -const ghostty_vt = @import("ghostty-vt"); // 256-color palette for .index cells const pardes = @import("../pardes.zig"); const vaxis_input = @import("../vaxis_input.zig"); const dump = @import("../dump.zig"); @@ -869,12 +868,12 @@ const Group = struct { }; /// The frame's draw groups, bottom to top: the page and the panes, the -/// notices floating over them, the guides and the debug box the core paints -/// over those, and ink (the bar cursors; the cursor's glide draws after it). +/// notices floating over them, the debug box the core paints over those, +/// and ink (the bar cursors; the cursor's glide draws after it). const Groups = struct { items: [4]Group = @splat(.{}), notices: usize = 1, - guides: usize = 2, + debug: usize = 2, ink: usize = 3, len: usize = 4, }; @@ -884,7 +883,7 @@ const Groups = struct { const Cover = packed struct(u16) { /// A layer draws it; the grid's copy is not drawn. layer: bool = false, - /// Under a guide or the debug box: drawn from the grid over the panes. + /// Under the debug box: drawn from the grid over the panes. floating: bool = false, /// In a pane's grip, `grip_offset` cells from its left: the grip's /// glyph is the cell that far to the left. @@ -951,7 +950,7 @@ fn coverFrame(cover: []Cover, cols: u16, rows: u16, body_layers: []const pardes. mark.rect(cover, cols, rows, .{ .x = region.rect.x, .y = 0, .w = 1, .h = rows }, "anchor", true); if (region.active) if (bar) |b| mark.rect(cover, cols, rows, .{ .x = region.rect.x, .y = b.y, .w = region.rect.w, .h = b.h }, "focus", true); }, - .guide, .debug => mark.rect(cover, cols, rows, region.rect, "floating", true), + .debug => mark.rect(cover, cols, rows, region.rect, "floating", true), else => {}, }; } @@ -4560,7 +4559,7 @@ fn renderFrame( while (col < surface.cols) : (col += 1) { const at = @as(usize, row) * surface.cols + col; if (covered[at].layer and !covered[at].floating) continue; - const group_index = if (covered[at].floating) groups.guides else 0; + const group_index = if (covered[at].floating) groups.debug else 0; groups.items[group_index].cell_count = std.math.add(u32, groups.items[group_index].cell_count, cellInstanceCount(&surface.cells[at])) catch return error.GpuCapacity; } } @@ -4609,7 +4608,7 @@ fn renderFrame( while (col < surface.cols) : (col += 1) { const at = @as(usize, row) * surface.cols + col; if (covered[at].layer and !covered[at].floating) continue; - const group_index = if (covered[at].floating) groups.guides else 0; + const group_index = if (covered[at].floating) groups.debug else 0; emitSurfaceCell( g, chrome, @@ -4762,12 +4761,12 @@ fn resolveCell(g: *Gui, line: []const pardes.Cell, at: usize, cursor: ?usize, ro const st = cell.style; fg = switch (st.fg) { .default => fg_default, - .index => |i| palColor(i), + .index => |i| pardes.colors.xterm[i], .rgb => |rgb| rgb, }; switch (st.bg) { .default => {}, - .index => |i| bg = palColor(i), + .index => |i| bg = pardes.colors.xterm[i], .rgb => |rgb| bg = rgb, } if (st.reverse) reverse = !reverse; @@ -5139,11 +5138,6 @@ fn cellCodepoint(cell: *const pardes.Cell) u32 { return if (cell.default or grapheme.len == 0) ' ' else firstCp(grapheme); } -fn palColor(idx: u8) [3]u8 { - const p = ghostty_vt.color.default[idx]; - return .{ p.r, p.g, p.b }; -} - fn firstCp(s: []const u8) u32 { if (s.len == 0) return ' '; const n = std.unicode.utf8ByteSequenceLength(s[0]) catch return ' '; |
