diff --git a/regress/kill-session-zoomed.sh b/regress/kill-session-zoomed.sh new file mode 100755 index 000000000..c27135ba2 --- /dev/null +++ b/regress/kill-session-zoomed.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Killing a session whose window is zoomed must not crash the server: +# window_destroy used to unzoom the window, which resized the panes and +# fired pane-resized with the window in the payload, and releasing that +# reference destroyed the window a second time. + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -LtestA$$ -f/dev/null" +$TMUX kill-server 2>/dev/null + +$TMUX -f/dev/null new -d -sfoo || exit 1 +$TMUX split-window -d -h -tfoo:0 || exit 1 +$TMUX resize-pane -Z -tfoo:0 || exit 1 +$TMUX new -d -sbar || exit 1 +$TMUX kill-session -tfoo || exit 1 +$TMUX has-session -tbar || exit 1 + +# The same with the zoomed window in a session killed by kill-server. +$TMUX new -d -sbaz || exit 1 +$TMUX split-window -d -v -tbaz:0 || exit 1 +$TMUX resize-pane -Z -tbaz:0 || exit 1 +$TMUX kill-server || exit 1 + +exit 0 diff --git a/regress/tty-keys.sh b/regress/tty-keys.sh index 19b1623dd..0a3ef318c 100644 --- a/regress/tty-keys.sh +++ b/regress/tty-keys.sh @@ -293,6 +293,16 @@ assert_key 'Escape [24@' 'C-S-F12' assert_key 'Escape [I' 'FocusIn' assert_key 'Escape [O' 'FocusOut' +# Focus events do not leave the prefix table. +$TMUX2 bind C-c set -g @focus-prefix yes +$TMUX2 set -g focus-events on +$TMUX send-keys C-b Escape '[O' Escape '[I' C-c +sleep 0.05 +if [ "$($TMUX2 show -gv @focus-prefix)" != yes ]; then + echo "[FAIL] FocusIn and FocusOut left the prefix table" + exit_status=1 +fi + # Paste keys assert_key 'Escape [200~' 'PasteStart' assert_key 'Escape [201~' 'PasteEnd'