Move back to starting position when pane is outside the window at all.

This commit is contained in:
nicm
2026-05-31 20:41:07 +00:00
parent 7a3b7ae812
commit e3ee2b327b

View File

@@ -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, 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) 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')) { if (args_has(args, 'x')) {
sx = args_percentage_and_expand(args, 'x', 0, USHRT_MAX, w->sx, 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; x = 4;
else { else {
x = w->last_new_pane_x + 4; 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; x = 4;
y = 2;
}
} }
w->last_new_pane_x = x; w->last_new_pane_x = x;
} }
@@ -2166,8 +2170,12 @@ window_pane_floating_geometry(struct window *w, __unused struct window_pane *wp,
y = 2; y = 2;
else { else {
y = w->last_new_pane_y + 2; 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; y = 2;
}
} }
w->last_new_pane_y = y; w->last_new_pane_y = y;
} }