mirror of
https://github.com/tmux/tmux.git
synced 2026-09-22 04:47:42 +00:00
Test for 5447 and for copy-mode zero line crash.
This commit is contained in:
63
regress/copy-mode-source-blank.sh
Normal file
63
regress/copy-mode-source-blank.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Trimming a blank source must leave a visible line for cursor reflow.
|
||||
|
||||
PATH=/bin:/usr/bin
|
||||
TERM=screen
|
||||
export PATH TERM
|
||||
|
||||
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
|
||||
TMUX="$TEST_TMUX -LtestA$$ -f/dev/null"
|
||||
|
||||
fail()
|
||||
{
|
||||
echo "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cleanup()
|
||||
{
|
||||
$TMUX kill-server 2>/dev/null
|
||||
}
|
||||
trap cleanup 0
|
||||
trap 'exit 1' 1 2 3 15
|
||||
|
||||
$TMUX new-session -d -x80 -y24 -s test 'sleep 100' || exit 1
|
||||
$TMUX set-option -g window-size manual || exit 1
|
||||
$TMUX new-window -t test:1 'sleep 100' || exit 1
|
||||
$TMUX resize-window -t test:0 -x20 -y24 || exit 1
|
||||
|
||||
# Exercise widening, narrowing, and equal widths with no source history.
|
||||
for pair in '0 1' '1 0' '1 2'; do
|
||||
set -- $pair
|
||||
if [ "$2" = 2 ]; then
|
||||
$TMUX new-window -t test:2 'sleep 100' || exit 1
|
||||
$TMUX resize-window -t test:2 -x80 -y24 || exit 1
|
||||
fi
|
||||
source=test:$1.0
|
||||
target=test:$2.0
|
||||
[ "$($TMUX display-message -p -t "$source" '#{history_size}')" = 0 ] ||
|
||||
fail "source has unexpected history"
|
||||
$TMUX copy-mode -s "$source" -t "$target" || exit 1
|
||||
$TMUX has-session -t test || fail "server died copying blank source"
|
||||
[ "$($TMUX display-message -p -t "$target" \
|
||||
'#{pane_in_mode} #{copy_cursor_x} #{copy_cursor_y}')" = '1 0 0' ] ||
|
||||
fail "blank source did not enter copy mode at the first cell"
|
||||
$TMUX send-keys -t "$target" -X cancel || exit 1
|
||||
done
|
||||
|
||||
# Real content still trims trailing empty lines, clamping the cursor to beta.
|
||||
$TMUX respawn-pane -k -t test:0.0 \
|
||||
"printf 'alpha\r\nbeta\r\n\r\n\r\n'; exec sleep 100" || exit 1
|
||||
i=0
|
||||
while [ "$($TMUX display-message -p -t test:0.0 '#{cursor_y}')" != 4 ]; do
|
||||
i=$((i + 1))
|
||||
[ "$i" -lt 10 ] || fail "source output did not arrive"
|
||||
sleep 1
|
||||
done
|
||||
$TMUX copy-mode -s test:0.0 -t test:1.0 || exit 1
|
||||
[ "$($TMUX display-message -p -t test:1.0 \
|
||||
'#{pane_in_mode} #{copy_cursor_y} #{copy_cursor_line}')" = '1 1 beta' ] ||
|
||||
fail "nonblank source content or trailing-line trimming changed"
|
||||
|
||||
exit 0
|
||||
71
regress/mode-tree-menu-position.sh
Normal file
71
regress/mode-tree-menu-position.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Chooser menus are centred on the mouse using their displayed width. A
|
||||
# hidden title must not move a borderless menu away from the mouse.
|
||||
|
||||
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
|
||||
}
|
||||
trap cleanup 0 1 15
|
||||
|
||||
fail()
|
||||
{
|
||||
echo "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
$TMUX new-session -d -s short -x 100 -y 30 'sleep 100' || exit 1
|
||||
$TMUX set -g mouse on || exit 1
|
||||
$TMUX set -g status off || exit 1
|
||||
$TMUX2 new-session -d -x 100 -y 30 "$TMUX attach" || exit 1
|
||||
sleep 1
|
||||
|
||||
for name in short aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; do
|
||||
$TMUX rename-session "$name" || exit 1
|
||||
for lines in none single padded; do
|
||||
$TMUX set -g menu-border-lines "$lines" || exit 1
|
||||
$TMUX choose-tree -s || exit 1
|
||||
sleep 1
|
||||
|
||||
# Right-button press at window (60, 0), away from either edge.
|
||||
seq=$(printf '\033[<2;61;1M')
|
||||
$TMUX2 send-keys -l "$seq" || exit 1
|
||||
sleep 1
|
||||
|
||||
row=2
|
||||
column=54
|
||||
if [ "$lines" = none ]; then
|
||||
row=1
|
||||
elif [ "$name" != short ]; then
|
||||
column=31
|
||||
fi
|
||||
text=$($TMUX2 capture-pane -p | awk -v row="$row" \
|
||||
-v column="$column" 'NR == row {
|
||||
# Keep byte offsets equal to columns with non-Unicode awk.
|
||||
gsub(/│/, "|")
|
||||
print substr($0, column, 7)
|
||||
}')
|
||||
[ "$text" = 'Select ' ] || \
|
||||
fail "$lines menu for $name: expected Select at ($column, $row), got '$text'"
|
||||
|
||||
# Close the menu, release the button, then leave the chooser.
|
||||
$TMUX2 send-keys Escape || exit 1
|
||||
seq=$(printf '\033[<2;61;1m')
|
||||
$TMUX2 send-keys -l "$seq" || exit 1
|
||||
$TMUX2 send-keys q || exit 1
|
||||
sleep 1
|
||||
done
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -106,9 +106,28 @@ compare menu-over-split
|
||||
|
||||
# Menu with no border lines.
|
||||
setup 40 14
|
||||
menu -b none -x6 -y8
|
||||
$TMUX2 display-menu -T "This title must not reserve width" -C 1 \
|
||||
-b none -x6 -y8 \
|
||||
"Alpha item" a "" \
|
||||
"Beta item" b "" \
|
||||
"" "" "" \
|
||||
"Gamma item" g "" || exit 1
|
||||
sleep 1
|
||||
compare menu-noborder
|
||||
|
||||
# Menu border style follows the explicitly targeted window, not the current
|
||||
# window when a different pane is selected.
|
||||
setup 40 14
|
||||
$TMUX2 set menu-border-lines none || exit 1
|
||||
$TMUX2 neww || exit 1
|
||||
$TMUX2 display-menu -t%0 -T "Menu" -C 1 \
|
||||
"Alpha item" a "" \
|
||||
"Beta item" b "" \
|
||||
"" "" "" \
|
||||
"Gamma item" g "" || exit 1
|
||||
$TMUX2 selectw -t%0 || exit 1
|
||||
compare menu-target-window-noborder
|
||||
|
||||
# Menu with double border lines.
|
||||
setup 40 14
|
||||
menu -b double -x6 -y8
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
MENU00 abcdefghij
|
||||
MENU01 abcdefghij
|
||||
MENU02[38;5;45m[48;5;235m Menu [39m[49m
|
||||
MENU03[38;5;45m[48;5;235m [38;5;250m Alpha item (a) [38;5;45m [39m[49m
|
||||
MENU04[38;5;45m[48;5;235m [38;5;16m[48;5;220m Beta item (b) [38;5;45m[48;5;235m [39m[49m
|
||||
MENU05[38;5;45m[48;5;235m [39m[49m
|
||||
MENU06[38;5;45m[48;5;235m [38;5;250m Gamma item (g) [38;5;45m [39m[49m
|
||||
MENU07[38;5;45m[48;5;235m [39m[49m
|
||||
MENU02 abcdefghij
|
||||
MENU03 abcdefghij
|
||||
MENU04[38;5;250m[48;5;235m Alpha item (a) [39m[49m
|
||||
MENU05[38;5;16m[48;5;220m Beta item (b) [39m[49m
|
||||
MENU06[38;5;45m[48;5;235m [39m[49m
|
||||
MENU07[38;5;250m[48;5;235m Gamma item (g) [39m[49m
|
||||
MENU08 abcdefghij
|
||||
MENU09 abcdefghij
|
||||
MENU10 abcdefghij
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
MENU00 abcdefghij
|
||||
MENU01 abcdefghij
|
||||
MENU02 abcdefghij
|
||||
MENU03 abcdefghij
|
||||
MENU04 abcd[38;5;250m[48;5;235m Alpha item (a) [39m[49m
|
||||
MENU05 abcd[38;5;16m[48;5;220m Beta item (b) [39m[49m
|
||||
MENU06 abcd[38;5;45m[48;5;235m [39m[49m
|
||||
MENU07 abcd[38;5;250m[48;5;235m Gamma item (g) [39m[49m
|
||||
MENU08 abcdefghij
|
||||
MENU09 abcdefghij
|
||||
MENU10 abcdefghij
|
||||
MENU11 abcdefghij
|
||||
MENU12 abcdefghij
|
||||
Reference in New Issue
Block a user