diff --git a/regress/new-pane-mouse.sh b/regress/new-pane-mouse.sh index 81f0e805b..06d594c8d 100644 --- a/regress/new-pane-mouse.sh +++ b/regress/new-pane-mouse.sh @@ -49,11 +49,33 @@ drag() sleep 1 } +# right_click COL ROW KEY +# +# Open the right-click menu at a 1-based position and choose KEY. +right_click() +{ + col="$1" + row="$2" + key="$3" + + seq=$(printf '\033[<2;%s;%sM' "$col" "$row") + $TMUX2 send-keys -t "$OUTER" -l "$seq" 2>/dev/null + sleep 0.2 + $TMUX2 send-keys -t "$OUTER" "$key" 2>/dev/null + sleep 1 +} + cleanup $TMUX new-session -d -s inner -x 80 -y 24 || exit 1 $TMUX set -g mouse on $TMUX set -g default-command 'sleep 100' +keys=$($TMUX list-keys -T root -F '#{key_command}' MouseDown3Empty) || + fail "list MouseDown3Empty failed" +case "$keys" in +*"New Pane"*"New Window"*) ;; +*) fail "missing empty-area menu binding: $keys" ;; +esac $TMUX2 new-session -d -x 80 -y 24 "$TMUX attach -t inner" || exit 1 sleep 1 @@ -80,6 +102,17 @@ $TMUX break-pane -W -s "$BASE" || fail "break base pane failed" $TMUX resize-pane -t "$BASE" -x10 -y4 || fail "resize floating base failed" $TMUX move-pane -t "$BASE" -P top-left || fail "move floating base failed" +# Right-click in empty window space and choose New Pane. This creates a new +# floating pane and tiles it. +right_click 20 8 p + +id=$($TMUX list-panes -F '#{?pane_active,#{pane_id},}' | tail -n 1) +[ -n "$id" ] || fail "no pane created from empty-area menu" +[ "$id" != "$BASE" ] || fail "empty-area menu did not create a new pane" + +must_equal "$($TMUX display-message -p -t "$id" '#{pane_floating_flag}')" 0 +$TMUX kill-pane -t "$id" || fail "kill empty-area menu pane failed" + # Drag in empty window space with no tiled pane underneath. drag 40 10 50 15 @@ -92,6 +125,12 @@ must_equal "$($TMUX display-message -p -t "$id" '#{pane_top}')" 10 must_equal "$($TMUX display-message -p -t "$id" '#{pane_width}')" 9 must_equal "$($TMUX display-message -p -t "$id" '#{pane_height}')" 4 +TILED=$($TMUX new-pane -PF '#{pane_id}' 'sleep 100') || + fail "new pane from only floating panes failed" +$TMUX join-pane -t "$TILED" || + fail "tile new pane from only floating panes failed" +must_equal "$($TMUX display-message -p -t "$TILED" '#{pane_floating_flag}')" 0 + TILED=$($TMUX new-window -dPF '#{pane_id}' 'sleep 100') || fail "new tiled window failed" $TMUX new-pane -d -M -L -t "$TILED" 'sleep 100' || fail "new-pane -M -L failed"