summaryrefslogtreecommitdiff
path: root/src/TerminalImages.zig
Commit message (Collapse)AuthorAge
* A terminal's kitty graphics draw as glyph art where pixels cannot, and by ↵Gabriel Schneider38 hours
| | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* A terminal pane draws the kitty graphics its program places, so yazi's image ↵Gabriel Schneider38 hours
and PDF previews show yazi asks the pane XTVERSION, and ghostty-vt answers "libghostty": yazi takes it for Ghostty and sends its previews by the kitty graphics protocol with Unicode placeholders (a=T,U=1, then U+10EEEE cells). ghostty-vt stored the images, but nothing drew them: the placeholders showed as tofu in the GUI and as raw codepoints in the tty, in every build since terminal panes answered queries (vkznsvzs, 2026-07-01). Before that no query was answered and yazi fell back to chafa's text art. Each frame, TerminalImages.zig reads the active screen's images and placements (virtual ones through their placeholder runs, and ones placed on a cell), cuts each into the cell rows it covers, maps those rows through the body's own row walk, clips them to the pane, and hands them on as ImagePlaces with exact geometry (NativePlacement.exact). The GUI draws them as textures; the tty passes them to an outer terminal with kitty graphics as one placement per row, its source cropped to whole cells. Placeholder cells draw no text. Scrolling, a delete, a resize, the alternate screen and a closed pane all fall out of reading the emulator's state every frame. A pane now knows its size in pixels: CSI 14/16/18 t are answered, the emulator's width_px/height_px follow the shell's cells, and the pty's winsize carries pixels (host_io.ptyWinsize), so yazi and a nested pardes size their images right. ghostty-vt's image store is 64 MiB per screen (its library default, 10 MB, refused a large preview), PNG transmissions are decoded with stb_image, and RGB images are converted only while shown. test/yazi_preview.py runs yazi in a hidden window on a PNG and a PDF and checks the captures, also through a tty pardes nested in the pane. Co-Authored-By: Claude Opus 5.5 <[email protected]>