From 0bb65902ebec104dac954b59f28500812419e1af Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 00:45:14 -0300 Subject: A terminal's kitty graphics draw as glyph art where pixels cannot, and by choice: Petscii on the pane, TermImages for new ones Under an outer terminal without kitty graphics a tty pardes cannot pass a terminal pane's images on, so it draws them itself as an image pane's Petscii does: each row of an image is matched to C64-palette glyph art over the cells it covers (GlyphArt.renderRect, the exact-grid half of GlyphArt.render), cached while it is on screen. yazi is still told the kitty protocol works, so it keeps sending its previews. The same art is a choice anywhere: the Petscii builtin now takes a terminal pane too (PaneKind.picture), flipping its images between pixels and glyphs, and a terminal holding images, or drawing them as glyphs by choice, says petscii:on|off in its tag as an image pane does. TermImages real|petscii (default real) is what a new terminal starts with; it is in DumpConfig, /ctl and the reference. Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index fb6aa4cf..f51409aa 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -43,12 +43,16 @@ pub const PaneKind = enum { terminal, pdf, image, + /// An image pane, or a terminal, whose program's kitty graphics are + /// pictures too. + picture, pub fn has(kind: PaneKind, pane: *const panes.Pane) bool { return switch (kind) { .terminal => pane.isTerminal(), .pdf => pane.hasPdf(), .image => pane.image != null, + .picture => pane.image != null or pane.isTerminal(), }; } @@ -57,6 +61,7 @@ pub const PaneKind = enum { .terminal => "a terminal", .pdf => "a PDF", .image => "an image", + .picture => "an image or a terminal", }; } }; @@ -981,11 +986,13 @@ pub const PdfSections = struct { } }; -/// glyph art over the host's pixels +/// glyph art over the host's pixels: an image pane's picture, or the +/// kitty graphics a terminal's program placed (yazi's previews) pub const Petscii = struct { - pub const needs: PaneKind = .image; + pub const needs: PaneKind = .picture; pub fn run(c: Ctx) void { if (c.pane.image) |*state| panes.Image.toggleGlyphArt(state); + panes.terminal.togglePetscii(c.pane); } }; -- cgit v1.3