From 572e26deb837e3275516bc6bb978c295d5da6499 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 20 May 2026 08:54:40 +0000 Subject: [PATCH] Some more trivial floating panes bits. --- cmd-split-window.c | 14 +++++++------- cmd-swap-pane.c | 10 ++++++++++ layout-custom.c | 2 +- screen-redraw.c | 3 +-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/cmd-split-window.c b/cmd-split-window.c index c95700dc..0b0372a8 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -42,10 +42,10 @@ const struct cmd_entry cmd_new_pane_entry = { .args = { "bc:de:fF:hIkl:Lm:p:PR:s:S:t:vx:X:y:Y:Z", 0, -1, NULL }, .usage = "[-bdefhIklPvZ] [-c start-directory] [-e environment] " "[-F format] [-l size] [-m message] [-p percentage] " - "[-s style] [-S active-border-style] " - "[-R inactive-border-style] [-x width] [-y height] " - "[-X x-position] [-Y y-position] " CMD_TARGET_PANE_USAGE " " - "[shell-command [argument ...]]", + "[-s style] [-S active-border-style] " + "[-R inactive-border-style] [-x width] [-y height] " + "[-X x-position] [-Y y-position] " CMD_TARGET_PANE_USAGE " " + "[shell-command [argument ...]]", .target = { 't', CMD_FIND_PANE, 0 }, @@ -60,9 +60,9 @@ const struct cmd_entry cmd_split_window_entry = { .args = { "bc:de:fF:hIkl:m:p:PR:s:S:t:vZ", 0, -1, NULL }, .usage = "[-bdefhIklPvZ] [-c start-directory] [-e environment] " "[-F format] [-l size] [-m message] [-p percentage] " - "[-s style] [-S active-border-style] " - "[-R inactive-border-style] " CMD_TARGET_PANE_USAGE " " - "[shell-command [argument ...]]", + "[-s style] [-S active-border-style] " + "[-R inactive-border-style] " CMD_TARGET_PANE_USAGE " " + "[shell-command [argument ...]]", .target = { 't', CMD_FIND_PANE, 0 }, diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index 7271e50e..a8e252e7 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -79,6 +79,12 @@ 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 floating panes"); + return (CMD_RETURN_ERROR); + } + server_client_remove_pane(src_wp); server_client_remove_pane(dst_wp); @@ -98,6 +104,10 @@ cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item) dst_wp->layout_cell = src_lc; dst_lc->wp = src_wp; src_wp->layout_cell = dst_lc; + 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); diff --git a/layout-custom.c b/layout-custom.c index 054be77f..deced6d8 100644 --- a/layout-custom.c +++ b/layout-custom.c @@ -336,7 +336,7 @@ layout_assign(struct window_pane **wp, struct layout_cell *lc, int flags) case LAYOUT_TOPBOTTOM: case LAYOUT_FLOATING: TAILQ_FOREACH(lcchild, &lc->cells, entry) - layout_assign(wp, lcchild, 1); + layout_assign(wp, lcchild, PANE_FLOATING); return; } } diff --git a/screen-redraw.c b/screen-redraw.c index a99d3557..d6a90a99 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -322,7 +322,7 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx, struct client *c = ctx->c; struct window *w = c->session->curw->window; int pane_status = ctx->pane_status, borders = 0; - int sx = w->sx, sy = w->sy;; + int sx = w->sx, sy = w->sy; /* Is this outside the window? */ if (pane_status == PANE_STATUS_BOTTOM) @@ -480,7 +480,6 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py, if (~wp->flags & PANE_FLOATING) tiled_only = 1; do { /* Loop until back to wp == start.*/ - if (!window_pane_visible(wp) || (tiled_only && (wp->flags & PANE_FLOATING))) goto next;