From e3ee2b327b7e7d0b35c1c4de9f4ca090bb174a01 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 31 May 2026 20:41:07 +0000 Subject: [PATCH] Move back to starting position when pane is outside the window at all. --- window.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/window.c b/window.c index 6b834d2f..5af4f823 100644 --- a/window.c +++ b/window.c @@ -2126,7 +2126,7 @@ window_pane_floating_geometry(struct window *w, __unused struct window_pane *wp, u_int *out_x, u_int *out_y, u_int *out_sx, u_int *out_sy, struct cmdq_item *item, struct args *args, char **cause) { - u_int x, y, sx = w->sx / 2, sy = w->sy / 2; + u_int x, y, sx = w->sx / 2, sy = w->sy / 4; if (args_has(args, 'x')) { sx = args_percentage_and_expand(args, 'x', 0, USHRT_MAX, w->sx, @@ -2151,8 +2151,12 @@ window_pane_floating_geometry(struct window *w, __unused struct window_pane *wp, x = 4; else { x = w->last_new_pane_x + 4; - if (w->last_new_pane_x > w->sx) + if (x + sx >= w->sx) { + w->last_new_pane_x = 0; + w->last_new_pane_y = 0; x = 4; + y = 2; + } } w->last_new_pane_x = x; } @@ -2166,8 +2170,12 @@ window_pane_floating_geometry(struct window *w, __unused struct window_pane *wp, y = 2; else { y = w->last_new_pane_y + 2; - if (w->last_new_pane_y > w->sy) + if (y + sy >= w->sy) { + w->last_new_pane_x = 0; + w->last_new_pane_y = 0; + x = 4; y = 2; + } } w->last_new_pane_y = y; }