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/tty/tty.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/tty') diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 5ad02c28..a358051e 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -847,6 +847,8 @@ fn exactKittyPlacement( .height = std.math.cast(u16, src_h) orelse return null, }, .pixel_offset = if (pixel_x != 0 or pixel_y != 0) .{ .x = @intCast(pixel_x), .y = @intCast(pixel_y) } else null, + // The outer terminal stacks them, under the text below 0. + .z_index = if (place.z != 0) place.z else null, .size = if (full) .{ .cols = std.math.cast(u16, cols) orelse return null, .rows = 1 } else -- cgit v1.3