mirror of
https://github.com/tmux/tmux.git
synced 2026-07-30 04:07:52 +00:00
Test for overlong runs of combining characters, GitHub issue 5434.
This commit is contained in:
@@ -174,3 +174,17 @@ check_raw_matches()
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_raw_no_matches()
|
||||
{
|
||||
name=$1
|
||||
shift
|
||||
|
||||
capture_raw "$name" >"$TMP"
|
||||
for unexpected in "$@"; do
|
||||
if grep -Eq "$unexpected" "$TMP"; then
|
||||
printf "%s\n" "$unexpected" >"$EXP"
|
||||
fail "$name raw unexpected"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -41,5 +41,9 @@ start_pane combining-left 10 3 '\314\201A\n'
|
||||
check_capture combining-left 'A'
|
||||
check_cursor combining-left '0,1'
|
||||
|
||||
start_pane combining-overflow 10 3 'u\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\n'
|
||||
check_raw_matches combining-overflow '^ C 0,0 data=\(1,31,u'
|
||||
check_raw_no_matches combining-overflow 'data=\(0,'
|
||||
|
||||
$TMUX kill-server 2>/dev/null
|
||||
exit $exit_status
|
||||
|
||||
@@ -34,6 +34,18 @@ captureen() {
|
||||
$TMUX capturep -peNS0 -E- >$TMP || exit 1
|
||||
}
|
||||
|
||||
timed() {
|
||||
if command -v timeout >/dev/null 2>&1; then
|
||||
timeout 5 "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
capture_timed() {
|
||||
timed $TMUX capturep -pS0 -E- >$TMP || exit 1
|
||||
}
|
||||
|
||||
check_line() {
|
||||
line=$1
|
||||
want=$2
|
||||
@@ -81,6 +93,8 @@ $TMUX2 neww -d \
|
||||
"printf '\033(0x\033(B'; exec sleep 100" || exit 1
|
||||
$TMUX2 neww -d \
|
||||
"awk 'BEGIN { for (i = 0; i < 1100; i++) printf \"a\" }'; exec sleep 100" || exit 1
|
||||
$TMUX2 neww -d \
|
||||
"printf 'u\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245\314\245'; exec sleep 100" || exit 1
|
||||
$TMUX2 selectw -t:0 || exit 1
|
||||
|
||||
$TMUX -f/dev/null new -d -x20 -y6 || exit 1
|
||||
@@ -245,4 +259,12 @@ capture
|
||||
len=$(sed -n 1p $TMP | wc -c)
|
||||
[ "$len" -ge 1100 ] || fail "long same-style line was truncated"
|
||||
|
||||
# Too many combining marks on one base character must not leave a standalone
|
||||
# width-zero cell that can make tty_draw_line loop forever on redraw.
|
||||
$TMUX resizew -x20 -y6 || exit 1
|
||||
timed $TMUX2 selectw -t:13 || fail "zero-width overflow select hung"
|
||||
sleep 1
|
||||
capture_timed
|
||||
check_grep '^u'
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user