From caffd9c1f8742a17431f7de0a2824d3fc02bfd72 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 28 Oct 2026 21:59:19 -0300 Subject: kitty z-index: a terminal image's z= goes with it, images go to the shell 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 --- src/surface.zig | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/surface.zig') diff --git a/src/surface.zig b/src/surface.zig index 8ed4074c..aa0068e3 100644 --- a/src/surface.zig +++ b/src/surface.zig @@ -257,6 +257,12 @@ pub const ImagePlace = struct { rgba: []const u8, iw: usize, ih: usize, + /// A terminal's kitty graphics stacking order (`z=`): the surface lists + /// a pane's images lowest first, so a shell drawing them in order puts + /// a higher one over a lower; below 0 the program means it under the + /// text, which the tty passes on to the outer terminal (the GUI draws + /// every image over the cells still). 0 for every other image. + z: i32 = 0, /// Rows [y, y+h) of `rgba` are the only ones that differ from the /// same pane page at revision `from`: a shell still holding that one may /// update just these rows instead of taking the whole image again. -- cgit v1.3