mirror of
https://github.com/tmux/tmux.git
synced 2026-09-06 05:30:46 +00:00
From github.com/darlingm/tmux, branch pr5516-regression-fixes. Adds 9 regression tests covering gaps found in the redraw-damage-rectangles branch: screen-write full/region redraw fallback, same-session window switches, wide-character clipping at damage edges, pane prompts and status lines surviving damage, floating-pane status format refresh, and multi-client damage delivery. redraw-multiclient.sh is adapted here to use ASCII pane borders (pane-border-lines simple) instead of darlingm's original UTF-8 borders: the original reliably "failed" under this test's nested tmux-in-tmux harness (relaying through an outer tmux client) due to that harness mis-rendering a cell that held a multi-byte UTF-8 border character being overwritten by later plain content - confirmed to be a nested-relay artifact, not a real bug, by replaying the identical drag sequence against a real terminal (xterm), where it never reproduces. ASCII borders avoid the artifact; the test still reliably catches the real "damage consumed by only one client" bug it targets (verified by reintroducing that bug and confirming the test fails). The other 8 tests are added verbatim from darlingm's branch. Four of them (popup-drag-status-line.sh, popup-drag-wide-character.sh, popup-drag-pane-prompt.sh, switch-client-redraw.sh) currently FAIL on this branch, since the source fixes they test for have not been merged yet - only the tests are being added here. Co-Authored-By: Michael K. Darling <darlingm@gmail.com> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
82 lines
1.9 KiB
Bash
Executable File
82 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Switching windows in the same session must redraw the attached client. The
|
|
# session object is shared, so its current winlink cannot be compared after it
|
|
# has already been changed.
|
|
|
|
PATH=/bin:/usr/bin
|
|
TERM=screen
|
|
LC_ALL=C.UTF-8
|
|
export PATH TERM LC_ALL
|
|
|
|
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
|
|
|
|
DIR=$(mktemp -d) || exit 1
|
|
INNER="$TEST_TMUX -Lswitch-redraw-inner-$$ -f/dev/null"
|
|
OUTER="$TEST_TMUX -Lswitch-redraw-outer-$$ -f/dev/null"
|
|
CAPTURE=$DIR/capture
|
|
|
|
fail()
|
|
{
|
|
echo "$*" >&2
|
|
[ -s "$CAPTURE" ] && cat "$CAPTURE" >&2
|
|
exit 1
|
|
}
|
|
|
|
cleanup()
|
|
{
|
|
$OUTER kill-server 2>/dev/null
|
|
$INNER kill-server 2>/dev/null
|
|
rm -rf "$DIR"
|
|
}
|
|
trap cleanup 0 1 15
|
|
|
|
wait_for_client()
|
|
{
|
|
i=0
|
|
while [ "$i" -lt 50 ]; do
|
|
CLIENT=$($INNER list-clients -F '#{client_name}' 2>/dev/null)
|
|
[ -n "$CLIENT" ] && return 0
|
|
sleep 0.1
|
|
i=$((i + 1))
|
|
done
|
|
fail "inner client did not attach"
|
|
}
|
|
|
|
wait_outer_has()
|
|
{
|
|
marker=$1
|
|
i=0
|
|
while [ "$i" -lt 50 ]; do
|
|
$OUTER capture-pane -p -t outer:0.0 >"$CAPTURE" 2>/dev/null || true
|
|
grep -q "$marker" "$CAPTURE" && return 0
|
|
sleep 0.1
|
|
i=$((i + 1))
|
|
done
|
|
fail "outer client did not show $marker"
|
|
}
|
|
|
|
$INNER new-session -d -s inner -x 40 -y 8 \
|
|
"printf '\033[2J\033[HA-WINDOW'; exec sleep 100" || exit 1
|
|
$INNER new-window -d -t inner:1 \
|
|
"printf '\033[2J\033[HB-WINDOW'; exec sleep 100" || exit 1
|
|
$INNER set-option -g status off || exit 1
|
|
$INNER set-option -g window-size manual || exit 1
|
|
|
|
$OUTER new-session -d -s outer -x 40 -y 8 'sleep 100' || exit 1
|
|
$OUTER set-option -g status off || exit 1
|
|
$OUTER set-option -g window-size manual || exit 1
|
|
$OUTER respawn-pane -k -t outer:0.0 \
|
|
"$TEST_TMUX -Lswitch-redraw-inner-$$ -f/dev/null attach-session -t inner:0" ||
|
|
exit 1
|
|
|
|
wait_for_client
|
|
wait_outer_has A-WINDOW
|
|
|
|
$INNER switch-client -c "$CLIENT" -t inner:1.0 || exit 1
|
|
[ "$($INNER display-message -p -t inner '#{window_index}')" -eq 1 ] ||
|
|
fail "server did not select window 1"
|
|
wait_outer_has B-WINDOW
|
|
|
|
exit 0
|