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/Term.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/Term.zig')
| -rw-r--r-- | src/Term.zig | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/Term.zig b/src/Term.zig index a21c3d97..ee178adc 100644 --- a/src/Term.zig +++ b/src/Term.zig @@ -6,6 +6,7 @@ //! this is the one file outside it that names a file inside it (and so //! the one place Phase 1 turns into the module's registration). const std = @import("std"); +const plain = @import("plain"); const terminal = @import("term/terminal.zig"); const pager = @import("term/pager.zig"); const echo = @import("term/echo.zig"); @@ -74,6 +75,8 @@ pub const Grid = struct { /// The view's top row while it is scrolled to one, null while it /// follows the output. view: ?usize = null, + /// Its grid's width (a pane's may differ while a resize is deferred). + cols: u16 = 0, }; /// What a `feed` told the rows the core keeps positions on: each tracked @@ -215,31 +218,35 @@ pub const Span = pager.Span; // ---- draw ---- // -// ponytail: not yet narrowed to plain data (docs/next-terminal.md's draw -// row): these still take the core's Pardes, Surface and Pane, read the -// pane's edit copy and write the surface's cells and placements -// themselves. Phase 1 needs them as a cell hand-over (`paint`) and a -// placement list (`images`) first. +// Plain data both ways: the core hands the theme's colours (`Ink`) and a +// buffer, and is given its view's cells (`Painted`, `PaintedRow`) and its +// images as placements; which of the body's rows they stand under is the +// core's (src/ansi.zig). -/// Its program's colours over the body's rows, through the theme's +/// Its view's rows as cells in the theme's colours, through the theme's /// filter when the pane has it on. -pub const recolor = terminal.recolorAnsi; +pub const paint = terminal.paint; /// Its kitty graphics over the body's rows, as placements. -pub const images = terminal.drawImages; +pub const images = terminal.images; +/// Its rows `first` and the `count` after it as text, prompts cut off (the +/// edit copy's rows, as they were). +pub const editRows = terminal.editRows; /// The Petscii builtin on it: its kitty graphics as glyph art, or back to /// pixels; null for none. pub const petscii = terminal.petscii; pub const togglePetscii = terminal.togglePetscii; /// Whether the screen showing holds any kitty graphics image. pub const hasImages = terminal.hasImages; -/// A program's colours mapped to the theme (Filter): a terminal's cells -/// or a +Pager's spans (`spanColor`). -pub const Filter = terminal.FilteredColors; -/// The theme's 256 colours as the filter maps onto them, kept while the -/// theme is the same (`Pardes.tty_filter_palette`). -pub const FilterPalette = terminal.FilterPalette; -/// A palette index as the theme draws it: its own sixteen, else the index. -pub const palColor = terminal.palColor; +/// The filter a +Pager's spans are drawn through, and a span's colour +/// through it. +pub const filter = terminal.pagerFilter; +pub const spanColor = terminal.spanColor; +pub const Ink = plain.term.Ink; +pub const FilterPalette = plain.term.FilterPalette; +pub const Filter = plain.term.Filter; +pub const Painted = plain.term.Painted; +pub const PaintedRow = plain.term.PaintedRow; +pub const ImagesAt = plain.term.ImagesAt; // ---- its replicas ---- |
