Do not allow 0x0 panes and remove a dead member.

This commit is contained in:
Nicholas Marriott
2026-09-09 14:39:14 +01:00
parent 19320c6969
commit 7049aa826a
5 changed files with 23 additions and 8 deletions

View File

@@ -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)

View File

@@ -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.

View File

@@ -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

1
tmux.h
View File

@@ -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;

2
tty.c
View File

@@ -544,8 +544,6 @@ void
tty_free(struct tty *tty)
{
tty_close(tty);
free(tty->r.ranges);
}
void