mirror of
https://github.com/tmux/tmux.git
synced 2026-10-10 04:04:27 +00:00
If no floating panes, reset default starting position, and reset if any part of
the pane goes outside the window.
This commit is contained in:
20
layout.c
20
layout.c
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: layout.c,v 1.100 2026/09/11 08:16:14 nicm Exp $ */
|
/* $OpenBSD: layout.c,v 1.101 2026/09/20 08:42:46 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -1728,7 +1728,7 @@ layout_floating_args_parse(struct cmdq_item *item, struct args *args,
|
|||||||
enum pane_lines lines, struct window *w, struct layout_geometry *lg,
|
enum pane_lines lines, struct window *w, struct layout_geometry *lg,
|
||||||
char **cause)
|
char **cause)
|
||||||
{
|
{
|
||||||
int sx, sy, ox, oy;
|
int sx, sy, ox, oy, pad;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
|
|
||||||
sx = lg->sx == UINT_MAX ? w->sx / 2 : lg->sx;
|
sx = lg->sx == UINT_MAX ? w->sx / 2 : lg->sx;
|
||||||
@@ -1777,12 +1777,20 @@ layout_floating_args_parse(struct cmdq_item *item, struct args *args,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!window_has_floating_panes(w)) {
|
||||||
|
w->last_new_pane_x = 0;
|
||||||
|
w->last_new_pane_y = 0;
|
||||||
|
}
|
||||||
if (ox == INT_MAX) {
|
if (ox == INT_MAX) {
|
||||||
if (w->last_new_pane_x == 0)
|
if (w->last_new_pane_x == 0)
|
||||||
ox = 4;
|
ox = 4;
|
||||||
else {
|
else {
|
||||||
|
if (lines != PANE_LINES_NONE)
|
||||||
|
pad = 1;
|
||||||
|
else
|
||||||
|
pad = 0;
|
||||||
ox = w->last_new_pane_x + 4;
|
ox = w->last_new_pane_x + 4;
|
||||||
if (w->last_new_pane_x > w->sx)
|
if (ox + sx + pad > (int)w->sx)
|
||||||
ox = 4;
|
ox = 4;
|
||||||
}
|
}
|
||||||
w->last_new_pane_x = ox;
|
w->last_new_pane_x = ox;
|
||||||
@@ -1793,8 +1801,12 @@ layout_floating_args_parse(struct cmdq_item *item, struct args *args,
|
|||||||
if (w->last_new_pane_y == 0)
|
if (w->last_new_pane_y == 0)
|
||||||
oy = 2;
|
oy = 2;
|
||||||
else {
|
else {
|
||||||
|
if (lines != PANE_LINES_NONE)
|
||||||
|
pad = 1;
|
||||||
|
else
|
||||||
|
pad = 0;
|
||||||
oy = w->last_new_pane_y + 2;
|
oy = w->last_new_pane_y + 2;
|
||||||
if (w->last_new_pane_y > w->sy)
|
if (oy + sy + pad > (int)w->sy)
|
||||||
oy = 2;
|
oy = 2;
|
||||||
}
|
}
|
||||||
w->last_new_pane_y = oy;
|
w->last_new_pane_y = oy;
|
||||||
|
|||||||
Reference in New Issue
Block a user