diff --git a/cmd-display-menu.c b/cmd-display-menu.c index ef369e1ba..a4f0184bf 100644 --- a/cmd-display-menu.c +++ b/cmd-display-menu.c @@ -452,7 +452,8 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item) sx = w->sx; if (sy > w->sy) sy = w->sy; - if (lines != PANE_LINES_NONE && (sx < 3 || sy < 3)) + if ((lines == PANE_LINES_NONE && (sx < 1 || sy < 1)) || + (lines != PANE_LINES_NONE && (sx < 3 || sy < 3))) goto out; if (!cmd_display_menu_get_menu_pos(tc, item, args, &px, &py, sx, sy)) goto out; @@ -546,9 +547,6 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item) events_fire("pane-title-changed", ep); } - cmd_find_from_winlink_pane(&fs, wl, new_wp, 0); - cmdq_insert_hook(s, item, &fs, "after-split-window"); - new_wp->wait_item = item; server_redraw_session(s); if (sc.argv != NULL) diff --git a/regress/control-client-popup.sh b/regress/control-client-popup.sh index 8a98d34e9..6eb78ae12 100644 --- a/regress/control-client-popup.sh +++ b/regress/control-client-popup.sh @@ -1,6 +1,7 @@ #!/bin/sh -# Popups require a tty overlay and cannot be displayed by a control client. +# Popups require an attached terminal and cannot be displayed by a control +# client. # A popup command from control mode must be ignored cleanly, leaving the # client command queue and server usable. diff --git a/regress/modal-pane.sh b/regress/modal-pane.sh index bc57a9bd1..3c5c1691a 100644 --- a/regress/modal-pane.sh +++ b/regress/modal-pane.sh @@ -375,6 +375,25 @@ esac check_ok kill-pane -t "$modal" sleep 1 +# Creating a popup pane must not fire the split-window hook. +check_ok set-hook -t modal after-split-window \ + "set-option -g @popup-after-split yes" +check_ok set-option -g @popup-after-split no +check_ok display-popup -E -t "$p0" true +must_equal "$($TMUX show-option -gv @popup-after-split)" no +check_ok set-hook -u -t modal after-split-window + +# A borderless popup must not create a zero-sized pane in a tiny window. +check_ok new-window -d -t modal: -n popup-small 'cat' +check_ok set-option -w -t modal:popup-small window-size manual +check_ok resize-window -t modal:popup-small -x 1 -y 1 +small=$(fmt modal:popup-small '#{pane_id}') +check_ok bind Z display-popup -B -t "$small" 'cat' +$TMUX2 send-keys -t "$OUTER" C-b Z +sleep 1 +must_equal "$(fmt modal:popup-small '#{window_panes}')" 1 +must_equal "$(fmt modal:popup-small '#{window_modal_pane}')" '' + $TMUX bind D display-popup -t "$p0" -w 20 -h 5 'printf done' $TMUX2 send-keys -t "$OUTER" C-b D sleep 2 diff --git a/tmux.h b/tmux.h index f29973ab5..4ce2f2d05 100644 --- a/tmux.h +++ b/tmux.h @@ -1795,7 +1795,6 @@ struct tty { size_t discarded; struct termios tio; - struct visible_ranges r; struct grid_cell cell; struct grid_cell last_cell; diff --git a/tty.c b/tty.c index 681d8291e..c34be958c 100644 --- a/tty.c +++ b/tty.c @@ -544,8 +544,6 @@ void tty_free(struct tty *tty) { tty_close(tty); - - free(tty->r.ranges); } void