From 537964b92dcd2b4a30fdf37a370f9a204fff561c Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 27 Aug 2016 23:35:00 +0000 Subject: [PATCH] Kill empty window after moving pane and updating current window, so that index is still valid before renumber-windows happens. Fixes issue reported by Eric Pruitt. --- cmd-join-pane.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd-join-pane.c b/cmd-join-pane.c index d630dd45..aa8c25f1 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -136,11 +136,6 @@ join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) window_lost_pane(src_w, src_wp); TAILQ_REMOVE(&src_w->panes, src_wp, entry); - if (window_count_panes(src_w) == 0) - server_kill_window(src_w); - else - notify_window_layout_changed(src_w); - src_wp->window = dst_w; TAILQ_INSERT_AFTER(&dst_w->panes, dst_wp, src_wp, entry); layout_assign_pane(lc, src_wp); @@ -157,6 +152,11 @@ join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) } else server_status_session(dst_s); + if (window_count_panes(src_w) == 0) + server_kill_window(src_w); + else + notify_window_layout_changed(src_w); notify_window_layout_changed(dst_w); + return (CMD_RETURN_NORMAL); }