mirror of
https://github.com/tmux/tmux.git
synced 2026-03-26 13:16:37 +00:00
Prohibit swapping 2 floating panes, that doesn't make sense.
This commit is contained in:
@@ -79,6 +79,11 @@ cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (src_wp == dst_wp)
|
||||
goto out;
|
||||
|
||||
if ((src_wp->flags & PANE_FLOATING) && (dst_wp->flags & PANE_FLOATING)) {
|
||||
cmdq_error(item, "cannot swap two floating panes");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
server_client_remove_pane(src_wp);
|
||||
server_client_remove_pane(dst_wp);
|
||||
|
||||
@@ -99,6 +104,13 @@ cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
dst_lc->wp = src_wp;
|
||||
src_wp->layout_cell = dst_lc;
|
||||
|
||||
/* Swap PANE_FLOATING flag to keep each pane consistent with its new
|
||||
* layout cell (floating cells have parent == NULL). */
|
||||
if ((src_wp->flags ^ dst_wp->flags) & PANE_FLOATING) {
|
||||
src_wp->flags ^= PANE_FLOATING;
|
||||
dst_wp->flags ^= PANE_FLOATING;
|
||||
}
|
||||
|
||||
src_wp->window = dst_w;
|
||||
options_set_parent(src_wp->options, dst_w->options);
|
||||
src_wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
|
||||
Reference in New Issue
Block a user