mirror of
https://github.com/tmux/tmux.git
synced 2026-10-15 16:04:34 +00:00
Keep retained indexed SIXEL data and the bounded per-terminal output cache. Use the cleaned-up decoder and RGBA encoder from image_merge, including parser memory limits, pixel-size handling and references for pending output. Match retained SIXEL scaling to the shared image cell footprint and emit black definitions for undefined colour registers. Keep Kitty input, output, layers and placeholders. Adapt backend selection, flags, drawing and cleanup to the callbacks and Iscrl capability. Keep the pane-status repaint with the requested XXX comment. Replace the elaborate fallback with image_merge's implementation, removing its caches, sample structures, quadrant/sextant features and ACS additions. Keep the image_merge regressions and adapt the Kitty tests to the simpler fallback. Use skip status 101 and disable Python bytecode for image tests. Small changes still outside image_merge: - Guard zero-height synchronized redraws before bit_nset. - Select the image backend when the tty opens. - Enable imagescroll by default for Kitty and Ghostty. - Keep the explanatory manual-window pixel-size comment (comment only). - Keep the additional SIXEL fixtures and visual test tools. Validation: image-enabled and disabled builds; 31 image and 13 related regressions pass normally and under ASAN. All image tests skip without images. Focused palette, parser, scaling, transparency and Kitty layer tests also pass after the retained-output adjustments. Diff checks clean.
82 lines
2.5 KiB
Bash
82 lines
2.5 KiB
Bash
#!/bin/sh
|
|
|
|
# A SIXEL image drawn over an earlier one replaces the pixels underneath
|
|
# for good, so an earlier image that is completely covered must not be kept
|
|
# and drawn again on every repaint - an animation would otherwise pile up a
|
|
# layer per frame.
|
|
#
|
|
# Draw two images over each other, then attach a client: it should be sent
|
|
# no more than it would be for one image. An image that is only partly
|
|
# covered must survive, so a second case draws a narrower image over a wider
|
|
# one and expects both.
|
|
|
|
. ./image-common.inc
|
|
|
|
PATH=/bin:/usr/bin
|
|
TERM=screen
|
|
LC_ALL=C.UTF-8
|
|
export TERM LC_ALL
|
|
|
|
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
|
|
TMUX="$TEST_TMUX -LtestA$$ -f/dev/null"
|
|
TMUX2="$TEST_TMUX -LtestB$$ -f/dev/null"
|
|
|
|
cleanup()
|
|
{
|
|
$TMUX kill-server >/dev/null 2>&1
|
|
$TMUX2 kill-server >/dev/null 2>&1
|
|
}
|
|
fail()
|
|
{
|
|
echo "$*" >&2
|
|
cleanup
|
|
exit 1
|
|
}
|
|
|
|
TMP=$(mktemp)
|
|
trap "cleanup; rm -f $TMP" 0 1 15
|
|
|
|
# Draw the given sixel commands in a new session, attach a sixel client and
|
|
# set N to the number of SIXEL images the client was sent (other DCS
|
|
# sequences, such as capability queries, do not count).
|
|
count_images()
|
|
{
|
|
cleanup
|
|
$TMUX new-session -d -s inner -x 40 -y 10 "printf '$1'; exec sh" ||
|
|
exit 1
|
|
sleep 0.3
|
|
image_check_support $TMUX
|
|
$TMUX set -as terminal-features ',*:sixel' || exit 1
|
|
|
|
$TMUX2 new-session -d -x 40 -y 10 || exit 1
|
|
OUTER=$($TMUX2 list-panes -F '#{pane_id}' | head -1)
|
|
[ -n "$OUTER" ] || fail "No outer pane."
|
|
$TMUX2 set -as terminal-features ',*:sixel@' ||
|
|
fail "disable outer sixel failed"
|
|
: >"$TMP"
|
|
$TMUX2 pipe-pane -t "$OUTER" -O "cat >$TMP" || fail "pipe-pane failed"
|
|
$TMUX2 send-keys -t "$OUTER" -l "$TMUX attach -t inner" ||
|
|
fail "send attach failed"
|
|
$TMUX2 send-keys -t "$OUTER" Enter || fail "send enter failed"
|
|
sleep 2
|
|
N=$(grep -aoE "$(printf '\033')P[0-9;]*q" "$TMP" | wc -l)
|
|
}
|
|
|
|
# One image on its own, as a baseline: a client is sent each image more than
|
|
# once, as the terminal features are confirmed after attaching.
|
|
count_images '\0337\033P9;1q#1!100~\033\\'
|
|
SINGLE=$N
|
|
[ "$SINGLE" -gt 0 ] || fail "sanity: client was sent no images"
|
|
|
|
# The same footprint twice, blue then red.
|
|
count_images '\0337\033P9;1q#1!100~\033\\\0338\033P9;1q#2!100~\033\\'
|
|
[ "$N" -eq "$SINGLE" ] ||
|
|
fail "covered image was kept: client was sent $N images, expected $SINGLE"
|
|
|
|
# A narrower image over a wider one leaves the wider one partly visible.
|
|
count_images '\0337\033P9;1q#1!100~\033\\\0338\033P9;1q#2!40~\033\\'
|
|
[ "$N" -gt "$SINGLE" ] ||
|
|
fail "partly covered image was lost: client was sent $N images, expected more than $SINGLE"
|
|
|
|
exit 0
|