Update tests for side status changes.

This commit is contained in:
Nicholas Marriott committed 2026-10-27 08:58:29 +00:00
1 parent f7ef88a100
commit 8e2fdcf723
6 files changed
+163 -21

No files matched your search

+28 -3
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# Clicking a window on the side status line, including the current window,
# dispatches the Status binding with that window.
# dispatches the SideStatus binding with that window.
PATH=/bin:/usr/bin
TERM=screen
@@ -42,9 +42,16 @@ $TMUX new-window -d -n two 'sleep 100' || exit 1
$TMUX set -g mouse on || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g side-status left || exit 1
$TMUX bind -n MouseDown1Status \
$TMUX bind -n MouseDown1SideStatus \
set -gF @click '#{mouse_status_range} #{window_name}' || exit 1
$TMUX bind -n MouseDown1StatusDefault set -g @click default || exit 1
$TMUX bind -n MouseDown1SideStatusDefault set -g @click default || exit 1
for suffix in Status StatusDefault StatusLeft StatusRight Control0 Control9; do
$TMUX bind -n "MouseDown1$suffix" set -g @click horizontal || exit 1
done
for suffix in Left Right Control0 Control9; do
$TMUX bind -n "MouseDown1SideStatus$suffix" \
set -g @click "$suffix" || exit 1
done
$TMUX2 new-session -d -s outer -x 60 -y 20 'sleep 100' || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 respawn-pane -k -t outer:0.0 "$TMUX attach -t inner" || exit 1
@@ -74,4 +81,22 @@ sleep 0.5
click 1 'foo one'
click 2 'foo one'
# Format ranges use side status events, including left, right and controls.
for range in left right control\|0 control\|9; do
$TMUX set -g side-status-format "#[range=$range]one#[norange]" ||
exit 1
sleep 0.5
case "$range" in
left) click 1 Left ;;
right) click 1 Right ;;
control\|0) click 1 Control0 ;;
control\|9) click 1 Control9 ;;
esac
done
$TMUX bind -n MouseDown1SideStatus \
set -gF @click '#{mouse_status_range}' || exit 1
$TMUX set -g side-status-format '#[range=pane|%0]one#[norange]' || exit 1
sleep 0.5
click 1 pane
exit 0
+3 -3
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# A Ctrl-drag starting on the side status line must not create a floating
# pane, and must still dispatch Status bindings. Ctrl-clicking a window on the
# pane, and must still dispatch SideStatus bindings. Ctrl-clicking a window on the
# side status line swaps windows, so panes are compared across the session.
PATH=/bin:/usr/bin
@@ -80,8 +80,8 @@ $TMUX set -g status on || exit 1
sleep 0.5
check_drag 3 10 30 12
# A drag starting on a window range dispatches the Status binding.
$TMUX bind -n C-MouseDrag1Status set -g @status-drag status || exit 1
# A drag starting on a window range dispatches the SideStatus binding.
$TMUX bind -n C-MouseDrag1SideStatus set -g @status-drag status || exit 1
$TMUX set -g @status-drag '' || exit 1
check_drag 2 2 30 12
got=$($TMUX show -gv @status-drag)
+105
View File
@@ -0,0 +1,105 @@
#!/bin/sh
. ./regress-common.inc
# Side status motion uses the named binding and leaves the prefix table active
# when unbound, including over the separator and every control range.
PATH=/bin:/usr/bin
TERM=screen
export PATH TERM
[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux)
TMUX="$TEST_TMUX -LtestA$$ -f/dev/null"
TMUX2="$TEST_TMUX -LtestB$$ -f/dev/null"
cleanup()
{
stop_server $TMUX2 || exit 1
stop_server $TMUX || exit 1
}
trap cleanup 0
trap 'exit 1' 1 2 15
fail()
{
echo "$side/$protocol/$key: $*" >&2
exit 1
}
# Follow the report with z so its binding proves the report was processed.
move()
{
if [ "$protocol" = sgr ]; then
seq=$(printf '\033[<35;%s;%sM' "$column" "$row")
$TMUX2 send-keys -t outer:0.0 -l "$seq" z || exit 1
else
bytes=$(printf '1b 5b 4d 43 %02x %02x 7a' \
"$((column + 32))" "$((row + 32))")
$TMUX2 send-keys -t outer:0.0 -H $bytes || exit 1
fi
}
$TMUX new-session -d -s inner -x 80 -y 20 \
"stty raw -echo; printf '\033[?1003h\033[?1006h'; exec cat" || exit 1
$TMUX set -g mouse on || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g side-status-width 14 || exit 1
$TMUX set -g assume-paste-time 0 || exit 1
$TMUX bind -n Any set -g @move any || exit 1
$TMUX bind -n z set -g @table root || exit 1
$TMUX bind -T prefix z set -g @table prefix || exit 1
$TMUX2 new-session -d -s outer -x 80 -y 20 \
"$TMUX attach -t inner" || exit 1
$TMUX2 set -g status off || exit 1
wait_for_clients 1 $TMUX || exit 1
serial=0
for side in left right; do
$TMUX set -g side-status "$side" || exit 1
for suffix in '' Left Right Default Border \
Control0 Control1 Control2 Control3 Control4 \
Control5 Control6 Control7 Control8 Control9; do
key=MouseMoveSideStatus$suffix
serial=$((serial + 1))
text=motion$serial
column=3
[ "$side" = right ] && column=69
row=1
case "$suffix" in
'') range='window|0' ;;
Left) range=left ;;
Right) range=right ;;
Control*) range="control|${suffix#Control}" ;;
Default) range=; row=3 ;;
Border)
range=; row=3; column=14
[ "$side" = right ] && column=67
;;
esac
format=$text
[ -n "$range" ] && format="#[range=$range]$text#[norange]"
$TMUX set -g side-status-format "$format" || exit 1
wait_for_text "$text" $TMUX2 capture-pane -p || exit 1
for protocol in sgr x10; do
$TMUX bind -n "$key" set -g @move "$key" || exit 1
$TMUX set -g @move pending || exit 1
$TMUX set -g @table pending || exit 1
move
wait_for_output root $TMUX show -gv @table ||
fail 'input did not reach the root binding'
[ "$($TMUX show -gv @move)" = "$key" ] ||
fail 'named motion binding did not fire'
$TMUX unbind -n "$key" || exit 1
$TMUX set -g @table pending || exit 1
$TMUX switch-client -T prefix || exit 1
move
wait_for_output prefix $TMUX show -gv @table ||
fail 'unbound motion left the prefix table'
done
done
done
exit 0
+18 -10
View File
@@ -53,9 +53,9 @@ $TMUX set -g 'status-format[1]' 'second' || exit 1
format='#{mouse_status_range}|#{mouse_status_line}|#{mouse_x}|#{mouse_y}'
format=$format'|#{session_name}|#{window_name}'
format=$format'|#{mouse_absolute_x}|#{mouse_absolute_y}'
for key in MouseDown1Status MouseDown1StatusDefault MouseDown1StatusBorder \
MouseDown1Pane; do
$TMUX bind -n "$key" set -gF @mouse "$format" || exit 1
for key in MouseDown1Status MouseDown1StatusDefault MouseDown1SideStatus \
MouseDown1SideStatusDefault MouseDown1SideStatusBorder MouseDown1Pane; do
$TMUX bind -n "$key" set -gF @mouse "$key|$format" || exit 1
done
$TMUX2 new-session -d -s outer -x 80 -y 20 'sleep 100' || exit 1
$TMUX2 set -g status off || exit 1
@@ -87,21 +87,29 @@ for side in left right; do
sleep 0.5
# The current session's windows are between the session headers.
click "$column" "$((offset + 1))" 'session|0|2|0|inner|zero'
click "$column" "$((offset + 1))" \
'MouseDown1SideStatus|session|0|2|0|inner|zero'
click "$((column + 3))" "$((offset + 3))" \
'window|2|5|2|inner|one'
click "$column" "$((offset + 4))" 'session|3|2|3|beta|other'
'MouseDown1SideStatus|window|2|5|2|inner|one'
click "$column" "$((offset + 4))" \
'MouseDown1SideStatus|session|3|2|3|beta|other'
click "$separator" "$((offset + 6))" \
"|5|$separator_x|5|inner|zero"
click "$pane_column" "$((offset + 7))" '||2|6|inner|zero'
"MouseDown1SideStatusBorder||5|$separator_x|5|inner|zero"
click "$pane_column" "$((offset + 7))" \
'MouseDown1Pane|||2|6|inner|zero'
click "$column" "$((offset + 8))" \
'MouseDown1SideStatusDefault||7|2|7|inner|zero'
# Horizontal status coordinates are relative to its first line,
# even if the clicked window's pane extends behind the status.
if [ "$status" != off ]; then
line=1
[ "$status" = bottom ] && line=19
click 3 "$line" 'window|0|2|0|inner|one'
click 3 "$((line + 1))" '|1|2|1|inner|zero'
click 3 "$line" \
'MouseDown1Status|window|0|2|0|inner|one'
click 3 "$((line + 1))" \
'MouseDown1StatusDefault||1|2|1|inner|zero'
fi
done
done
+5 -5
View File
@@ -69,8 +69,8 @@ $TMUX set -g mouse on || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g side-status-format \
'#[range=window|0]window#[norange]' || exit 1
$TMUX bind -n MouseDrag1Status set -g @text-drag yes || exit 1
$TMUX bind -n MouseDrag1StatusDefault set -g @blank-drag yes || exit 1
$TMUX bind -n MouseDrag1SideStatus set -g @text-drag yes || exit 1
$TMUX bind -n MouseDrag1SideStatusDefault set -g @blank-drag yes || exit 1
$TMUX2 new-session -d -s outer -x 80 -y 20 'sleep 180' || exit 1
$TMUX2 set -g status off || exit 1
$TMUX2 new-session -d -s other -x 80 -y 20 'sleep 180' || exit 1
@@ -176,9 +176,9 @@ $TMUX set -t inner side-status-width 20 || exit 1
check 20
$TMUX set -g @border-drag no || exit 1
$TMUX set -g @border-end no || exit 1
$TMUX bind -n MouseDrag1StatusBorder \
$TMUX bind -n MouseDrag1SideStatusBorder \
set -gF @border-drag '#{mouse_absolute_x},#{mouse_absolute_y}' || exit 1
$TMUX bind -n MouseDragEnd1StatusBorder set -g @border-end yes || exit 1
$TMUX bind -n MouseDragEnd1SideStatusBorder set -g @border-end yes || exit 1
mouse 0 61 6 M
mouse 32 40 6 M
mouse 32 42 6 M
@@ -188,7 +188,7 @@ check 20
fail "custom border binding did not get the terminal coordinates"
[ "$($TMUX show -gv @border-end)" = yes ] ||
fail "border drag end binding did not fire"
$TMUX unbind -n MouseDrag1StatusBorder || exit 1
$TMUX unbind -n MouseDrag1SideStatusBorder || exit 1
mouse 0 61 6 M
mouse 32 40 6 M
mouse 0 40 6 m
+4
View File
@@ -108,6 +108,10 @@ for position in bottom top; do
done
# The same targeting must work vertically on either side status line.
$TMUX bind -n MouseDown1SideStatus \
'selectw ; set -F @drag_window "#{window_id}"' || exit 1
$TMUX bind -n MouseDrag1SideStatus run -C 'swapw -ds#{@drag_window}' || exit 1
$TMUX bind -n MouseDragEnd1SideStatus set -u @drag_window || exit 1
$TMUX set -g status off || exit 1
$TMUX set -g side-status-format \
'#{W:#[range=window|#{window_index}]#W#[norange]#[nl]}' || exit 1