summaryrefslogtreecommitdiff
path: root/src/TerminalImages.zig
Commit message (Collapse)AuthorAge
* surface: a frame's images are a std.ArrayList(ImagePlace), where they were a ↵Gabriel Schneider13 days
| | | | | | | slice of optionals grown by hand (appendImagePlace's doubling realloc, nimages beside it) whose slots were never null: every reader's `orelse continue` and `.?` go (gui, tui, terminal, TerminalImages, ninep/screen, test/pdf.zig, kitty and the two PDF benches); macos.zig's loop the same, passing ast-check but not built here Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
* kitty z-index: a terminal image's z= goes with it, images go to the shell ↵Gabriel Schneider2026-10-28
| | | | | | | | | | | | lowest first, and the tty hands z on to the outer terminal (under the text below 0); real clients recorded, replayed and run live z-index was lost: an ImagePlace had none, so every image went over the cells in hash-map order, a z<0 picture (a background under text) over the text and overlapping images in any order. ImagePlace.z now carries the placement's z (a virtual placement's from its placeholder target), TerminalImages sorts what it appends lowest z first (stable), and the tty's exactKittyPlacement sets vaxis's z_index, so a kitty terminal outside stacks them and puts z<0 under the text. The GUI draws them in that order but still over the cells: under the text there needs a glyph pass after the images (ui.frag's clear_bg_bit) in gui.zig's vertex buffer. Real clients: test/kitty_harness.zig's PARDES_KITTY_EXPLORE runs commands in the pane under script(1) and prints what pardes placed outside; kitten icat 0.49.2 (--align left/center/right, --place, --scale-up, --unicode-placeholder, --clear, file/memory/stream/detect), chafa 1.18.3, viu and yazi 26.9.1 all landed where they should. Their recorded traffic (test/kitty-fixtures/*.vt) replays through the core (test/kitty.zig) to the cells they drew live. The harness now also runs yazi live (shared memory, a virtual placement, placeholders), checks z=-1 outside, and runs a second pardes under a terminal without kitty graphics: no graphics command reaches it and the image is glyph art in all 32 cells. The harness empties NO_COLOR (zig build sets it, and vaxis drew no colour at all under the harness) by setenv, not unsetenv, which compacts the environment std captured. Also: tests that a pane's image follows pardes's own scrollback, an edited copy taller than its rows, a narrow pane's edge, Collapse and a cell-size change; and a knownGap: images do not survive a dump (Dump, Handover, a pane reopened from the Store), whose VT text has none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* kitty graphics conformance for terminal panes: a core suite (test/kitty.zig, ↵Gabriel Schneider2026-10-28
| | | | | | | | | | | | | | `zig build kitty-test`, in unit-test) and an end-to-end harness (`zig build kitty-harness`, tty and gui); four gaps it found fixed, one left The core suite feeds a pane's output as pty reads do and checks what the program reads back, ghostty's image storage and the ImagePlaces a frame draws: queries and their errors, q=0/1/2, f=24/32/100 and o=z, chunked m=1 split at every read size, t=f/t=t/t=s, a=T and C=1 cursor movement, a=p by placement id with source rects and re-puts, image numbers, every d= delete (a/A i/I n/N c/C p/P q/Q x/X y/Y z/Z r/R) and a delete abandoning a chunked load, Unicode placeholders over two rows with implicit columns and a placement named in the underline colour, scroll/resize/reflow, the alternate screen, clear (ED 2 + ED 3), replies per pane and never in the cells, many replies from one read, kitty before DA, CAN/SUB, an oversized image, 300 images against the storage limit, animations and relative placements. The harness runs test/kitty_client.zig in a pane's bash (query, a 16-chunk 8x4-cell place, the three media, quiet levels, CAN, show then delete) and kitten icat (stream and detect) and chafa when installed. Outside, the tty arm is a kitty terminal (a ghostty-vt emulator): the image pardes re-emits lands at the cell after ANCHOR>, 8x4 cells a row at a time, the client's own commands and replies never pass through, and d=I frees what was sent. The gui arm reads the GPU capture. Fixed: kitty file, temporary-file and shared-memory media (libghostty defaults to direct only; now allWithTempDir like ghostty and kitty); replies past 256 bytes of one read were cut mid-sequence (4 KiB now, an answer that does not fit dropped whole and counted); animations never played (TerminalImages draws renderData(), ticks ImageStorage.animationTick on the core clock, nextWake wakes for the next frame); relative placements (P=/Q=/H=/V=) were not drawn (resolveChain, as ghostty's renderer). image.decode no longer jumps through stb_image's null allocator before image.start. Known gap (a knownGap test): no z-index; every image is drawn over the cells in storage order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Build with Zig 0.17Gabriel Schneider2026-10-22
| | | | | | | | | | | ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* A terminal's kitty graphics draw as glyph art where pixels cannot, and by ↵Gabriel Schneider2026-10-01
| | | | | | | | | | | | | | | | | | | | 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 Schneider2026-10-01
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]>