fix(artwork): ignore TMUX/ZELLIJ/STY values that mean 'not set'

Some shells and wrappers export ZELLIJ=0 or TMUX=0 outside a multiplexer.
A plain truthiness check treated that as 'inside tmux/zellij' and
downgraded iTerm2/Kitty to the ANSI mosaic, so real artwork silently
disappeared. Only meaningful values now count.
This commit is contained in:
beefcarver committed 2026-10-30 18:43:16 -04:00
1 parent 69b46b9035
commit 6eb0c6b6fe
2 files changed
+27 -4

No files matched your search

+11
View File
@@ -62,3 +62,14 @@ async def test_fetch_validates_and_caches() -> None:
fetched = await artwork.fetch(client, url)
assert fetched == data
assert artwork.load_cached(url) == data
def test_multiplexer_env_values_that_mean_no() -> None:
# Some wrappers export ZELLIJ=0 / TMUX=0 outside a multiplexer; that must
# not disable iTerm2 or Kitty graphics.
assert artwork.detect_protocol({"ZELLIJ": "0", "TERM_PROGRAM": "iTerm.app"}) == "iterm2"
assert artwork.detect_protocol({"ZELLIJ": "", "TERM_PROGRAM": "iTerm.app"}) == "iterm2"
assert artwork.detect_protocol({"TMUX": "0", "KITTY_WINDOW_ID": "1"}) == "tgp"
# ...while a real multiplexer still downgrades to the mosaic.
assert artwork.detect_protocol({"TMUX": "/tmp/tmux-501/default,1,0", "TERM_PROGRAM": "iTerm.app"}) is None
assert artwork.detect_protocol({"STY": "1234.pts-0.host", "TERM_PROGRAM": "iTerm.app"}) is None