From 8f6621f9f70db86d56266a59b56dfb92b324b0d9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 00:51:06 -0300 Subject: Term: the replica half and the seam's last reaches: screen_state.zig's terminal half is reached through the interface (Term.encode, Term.encodeRows and Term.untrack on the authority, Term.wasRead and Term.clearRead for the rows a step read, Term.apply with the prompt marks riding a delta, Term.applyRows, Term.shown and Term.blank on a replica, Term.Encoder, Track, Peer and Replica its handles), so replica.zig reaches no emulator state; its kind half (a kind's frame as a Shadow, its strips and Blobs, encodeShadow) is the core's and moves, as it is, with its tests, to Kind.zig beside the Slot it shadows; predicted echo is Term.Echo; the draw entries (Term.recolor, Term.images, Term.petscii, Term.togglePetscii, Term.hasImages, Term.Filter, Term.FilterPalette, Term.palColor) are reached through the interface with their signatures as they were, not yet plain data (Term.zig says so); src/Term.zig is the one file outside src/term/ that imports one inside it (fs.zig embeds terminal.zig's text as a served source), panes.terminal, pardes.screen_state and pardes.echo go, the comments that named ghostty for the emulator say the emulator, and the tests that read emulator state read the records but three (Core.zig's palette, pty.zig's output pin and page limit); the changelog says so; nothing else changes --- src/Term.zig | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'src/Term.zig') diff --git a/src/Term.zig b/src/Term.zig index 6c9bd4e3..a21c3d97 100644 --- a/src/Term.zig +++ b/src/Term.zig @@ -8,6 +8,11 @@ const std = @import("std"); const terminal = @import("term/terminal.zig"); const pager = @import("term/pager.zig"); +const echo = @import("term/echo.zig"); +/// The screen state replicas are sent (its encoder, a terminal's versions, +/// what a peer holds, a replica's side), and its streams and soak for the +/// replica tests outside src/. +pub const screen_state = @import("term/screen_state.zig"); /// A terminal pane's emulator, its parse and what pardes keeps beside it. pub const State = terminal.State; @@ -208,6 +213,63 @@ pub const Page = pager.Page; /// Bytes `start..end` of a page's text, drawn in `style`. 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. + +/// Its program's colours over the body's rows, through the theme's +/// filter when the pane has it on. +pub const recolor = terminal.recolorAnsi; +/// Its kitty graphics over the body's rows, as placements. +pub const images = terminal.drawImages; +/// 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; + +// ---- its replicas ---- + +/// What a peer is owed of it, a delta against what the peer was sent. +pub const encode = terminal.encode; +/// Rows of it a replica holds as holes. +pub const encodeRows = terminal.encodeRows; +/// A peer's track of it let go. +pub const untrack = terminal.untrack; +/// Whether a step read its rows since `clearRead`. +pub const wasRead = terminal.wasRead; +pub const clearRead = terminal.clearRead; +/// A replica's side: a delta applied, rows applied, the rows its view +/// shows, rows blank until they come. +pub const apply = terminal.apply; +pub const applyRows = terminal.applyRows; +pub const shown = terminal.shown; +pub const blank = terminal.blank; +pub const dumpScreen = terminal.dumpScreen; +pub const Encoder = screen_state.Encoder; +pub const Track = screen_state.Track; +pub const Peer = screen_state.Peer; +pub const Replica = screen_state.Replica; +/// A replica's keys into a terminal drawn at once, before its authority +/// says (predicted echo). +pub const Echo = echo.Echo; + test { + _ = terminal; _ = pager; + _ = echo; + _ = screen_state; } -- cgit v1.3