diff options
| author | Ingmar Steen <iksteen@gmail.com> | 2026-09-06 19:41:56 +0200 |
|---|---|---|
| committer | Ingmar Steen <iksteen@gmail.com> | 2026-09-06 19:41:56 +0200 |
| commit | b6fbc2184ff26425e212d88bbb3de04066a9e5f6 (patch) | |
| tree | 49995f79ed0dcf9acca85cedf5cde0aa18e6e508 /tests | |
| parent | graphics: place an image once, not once per frame (diff) | |
| download | slosh-b6fbc2184ff26425e212d88bbb3de04066a9e5f6.tar.gz slosh-b6fbc2184ff26425e212d88bbb3de04066a9e5f6.tar.xz slosh-b6fbc2184ff26425e212d88bbb3de04066a9e5f6.zip | |
graphics: state z=0 on a placement, so a mirror paints it over the text
kitty's default z is 0, which draws an image above the text, and that is
the value slosh has always relied on -- it places after the cell diff
precisely so the picture ends up on top. Saying nothing works because
the terminal supplies the default.
Anything mirroring the stream has no such default to fall back on. It
cannot tell "the emitter wants this over the text" from "the emitter
said nothing", and shellglass's viewer paints an unstated image under
the cells. That is fine until a cell over the picture carries an
explicit background -- and dim_unfocused gives one to every cell of a
pane at once, so the moment focus moved elsewhere the whole image
disappeared from the mirrored copy while the terminal, which took the
default, still showed it.
So the placement states z=0. Nothing changes on a terminal, since that
is the value it was already assuming; the mirror now paints the picture
over the cells and the dim pass runs underneath it, where it belongs.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CRz3zwZJvBvzsR9k4cj6dd
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_graphics.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_graphics.py b/tests/test_graphics.py index f8d7a0d..50edf43 100644 --- a/tests/test_graphics.py +++ b/tests/test_graphics.py @@ -289,6 +289,26 @@ def test_sub_cell_offsets_survive_to_the_client(): ) +def test_a_placement_says_it_sits_above_the_text(): + """z=0 is kitty's default, so saying it changes nothing on a terminal. + + It is the whole picture for anything mirroring the stream, which cannot + otherwise tell "the emitter wants this over the text" from "the emitter + said nothing" -- and one that guesses "under" loses the image behind the + first background painted over those cells, dim_unfocused being the one + that paints over every cell of a pane at once. + """ + with Session(sends_image(), cols=44, rows=10) as s: + s.settle(200) + raw = s.api("graphics", format="bytes")["bytes"] + place = [c for c in raw.split("\x1b") if c.startswith("_Ga=p")] + check( + "the placement states its z", + place and "z=0" in place[0], + str(place), + ) + + def test_a_placement_with_no_offset_emits_none(): with Session(transmits_then_places("p,i=7,p=1,q=2,c=6,r=2"), cols=44, rows=10) as s: s.settle(200) @@ -661,6 +681,7 @@ if __name__ == "__main__": test_an_image_outlives_a_screen_clear() test_a_screen_clear_still_removes_what_is_on_screen() test_sub_cell_offsets_survive_to_the_client() + test_a_placement_says_it_sits_above_the_text() test_a_placement_with_no_offset_emits_none() test_a_natural_image_is_never_rescaled_as_it_moves() test_a_scaled_image_keeps_the_cell_count_it_asked_for() |
