From af36d7c4300d1fc12facf166948294049b4bd9a8 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Sep 2025 07:53:49 +0000 Subject: [PATCH] Ensure break-pane -P prints when only one pane is left. From Chaoyi Yin in GitHub issue 4615. --- cmd-break-pane.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd-break-pane.c b/cmd-break-pane.c index a5582e46..add3743b 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -85,7 +85,10 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item) options_set_number(w->options, "automatic-rename", 0); } server_unlink_window(src_s, wl); - return (CMD_RETURN_NORMAL); + wl = winlink_find_by_window(&dst_s->windows, w); + if (wl == NULL) + return (CMD_RETURN_ERROR); + goto out; } if (idx != -1 && winlink_find_by_index(&dst_s->windows, idx) != NULL) { cmdq_error(item, "index in use: %d", idx); @@ -132,6 +135,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item) if (src_s != dst_s) server_status_session_group(dst_s); +out: if (args_has(args, 'P')) { if ((template = args_get(args, 'F')) == NULL) template = BREAK_PANE_TEMPLATE;