diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 03:25:13 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | a3509e4df5efc94b0deee3b06dd72f85b0d96647 (patch) | |
| tree | 86be50532fe55f9232c7ba59c3e5007895f7f85e /src/File.zig | |
| parent | 98f84f99e79cccc2344aff2efe10823540d0c7b7 (diff) | |
| download | pardes-a3509e4df5efc94b0deee3b06dd72f85b0d96647.tar.gz pardes-a3509e4df5efc94b0deee3b06dd72f85b0d96647.zip | |
Term: the draw group as plain data (docs/next-terminal.md, Phase 1): the terminal paints its view into a plain cell buffer and the core lays it over the body's rows; Term.paint gives each of its view's rows (Term.PaintedRow: the prompt cut a shell's marks make of it, its kitty placeholders, how many cells it has) and each cell (Term.Painted: its style in the theme's colours, through the filter when the pane has it on, the bytes it spells, its width) for a theme handed in as Term.Ink; src/ansi.zig, new, is the core's half of what was terminal.zig's recolorAnsi, moved: the body walk, the edit copy's anchors (EditAnchors, its rows from Term.editRows) and the grapheme-to-cell alignment, now reading the buffer instead of the emulator's pages, and drawImages' body walk (Term.images takes the rows it maps and appends placements to the frame's list, blanking placeholder cells in its cells, as TerminalImages.draw did through Pardes); the filter stays the terminal's (it wraps ghostty's generate256Color), its record plain (Term.Filter, Term.FilterPalette in src/plain/term.zig, [3]u8 for ghostty's RGB), so a +Pager's spans are drawn through Term.filter and Term.spanColor, and palColor is Ink.palColor; config.tty_filter_min_contrast goes to the filter it bounds; Term.Grid gains the grid's cols; the filter tests reach the plain record's fields through asGhostRgb, asserting what they did; perf --terminal-mib (tail-style line off, ReleaseFast, instructions:u, 3 runs each, ±30k): 8 MiB 4,347.9M -> 3,949.8M (4.51M -> 4.09M a batch), 32 MiB 14,729.1M -> 13,294.4M (3.82M -> 3.45M a batch), the copy costs nothing that shows and the frame got cheaper; core-test 985/985, kitty-test 45/45, pane-test 151/152 (1 skipped), behaviour-test 268/272 (the four addon ABI 3.0 tests the base fails), replicas checked/wrong 0
Diffstat (limited to 'src/File.zig')
| -rw-r--r-- | src/File.zig | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/File.zig b/src/File.zig index 64614191..d4032171 100644 --- a/src/File.zig +++ b/src/File.zig @@ -13,6 +13,7 @@ const filesystem = @import("fs.zig"); const syntax = @import("syntax.zig"); const diff = @import("diff.zig"); const tracy = @import("tracy.zig"); +const ansi = @import("ansi.zig"); const limits = @import("memory.zig").limits; const locations = @import("locations.zig"); const Colors = @import("colors.zig"); @@ -1831,9 +1832,10 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes. // A row whose first byte names a hue (syntax.ground_add, _del): its // grounds, the theme's, worked out once a frame and only for one. var grounds: ?Colors.Grounds = null; + const ink = ansi.inkOf(p.theme()); var filtered_storage: pardes.Term.Filter = undefined; const filtered: ?*pardes.Term.Filter = if (pane.tty_filter and spans.len > 0) blk: { - filtered_storage = .init(p, null); + filtered_storage = pardes.Term.filter(&ink, &p.tty_filter_palette); break :blk &filtered_storage; } else null; // indexed start, same as bodyText — an empty tail simply paints nothing @@ -1957,11 +1959,11 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes. // palette colour through the theme's sixteen and // truecolor as it is. if (filtered) |colors| { - if (st.fg != .default) cell.style.fg = colors.spanColor(st.fg, false); - if (st.bg != .default) cell.style.bg = colors.spanColor(st.bg, true); + if (st.fg != .default) cell.style.fg = pardes.Term.spanColor(colors, st.fg, false); + if (st.bg != .default) cell.style.bg = pardes.Term.spanColor(colors, st.bg, true); } else { - if (st.fg != .default) cell.style.fg = if (st.fg == .index) pardes.Term.palColor(p, st.fg.index) else st.fg; - if (st.bg != .default) cell.style.bg = if (st.bg == .index) pardes.Term.palColor(p, st.bg.index) else st.bg; + if (st.fg != .default) cell.style.fg = if (st.fg == .index) ink.palColor(st.fg.index) else st.fg; + if (st.bg != .default) cell.style.bg = if (st.bg == .index) ink.palColor(st.bg.index) else st.bg; } cell.style.bold = cell.style.bold or st.bold; cell.style.dim = st.dim; |
