summaryrefslogtreecommitdiffstats
path: root/layout.c
diff options
context:
space:
mode:
authornicm <nicm>2021-03-11 06:31:05 +0000
committernicm <nicm>2021-03-11 06:31:05 +0000
commitd98f9f7fe56beefeb294184ffaed24b7ea510a97 (patch)
tree46adbfe0fbc5e7f4a782792470c8d8e5465ee79c /layout.c
parent7f87280cd539c26a9b088cca2de895dd86b60449 (diff)
Add split-window -Z to start the pane zoomed, GitHub issue 2591.
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/layout.c b/layout.c
index 37214d02..04a13b0c 100644
--- a/layout.c
+++ b/layout.c
@@ -286,7 +286,7 @@ layout_add_border(struct window *w, struct layout_cell *lc, int status)
/* Update pane offsets and sizes based on their cells. */
void
-layout_fix_panes(struct window *w)
+layout_fix_panes(struct window *w, struct window_pane *skip)
{
struct window_pane *wp;
struct layout_cell *lc;
@@ -294,7 +294,7 @@ layout_fix_panes(struct window *w)
status = options_get_number(w->options, "pane-border-status");
TAILQ_FOREACH(wp, &w->panes, entry) {
- if ((lc = wp->layout_cell) == NULL)
+ if ((lc = wp->layout_cell) == NULL || wp == skip)
continue;
wp->xoff = lc->xoff;
@@ -482,7 +482,7 @@ layout_init(struct window *w, struct window_pane *wp)
lc = w->layout_root = layout_create_cell(NULL);
layout_set_size(lc, w->sx, w->sy, 0, 0);
layout_make_leaf(lc, wp);
- layout_fix_panes(w);
+ layout_fix_panes(w, NULL);
}
void
@@ -540,7 +540,7 @@ layout_resize(struct window *w, u_int sx, u_int sy)
/* Fix cell offsets. */
layout_fix_offsets(w);
- layout_fix_panes(w);
+ layout_fix_panes(w, NULL);
}
/* Resize a pane to an absolute size. */
@@ -600,7 +600,7 @@ layout_resize_layout(struct window *w, struct layout_cell *lc,
/* Fix cell offsets. */
layout_fix_offsets(w);
- layout_fix_panes(w);
+ layout_fix_panes(w, NULL);
notify_window("window-layout-changed", w);
}
@@ -704,10 +704,14 @@ layout_resize_pane_shrink(struct window *w, struct layout_cell *lc,
/* Assign window pane to newly split cell. */
void
-layout_assign_pane(struct layout_cell *lc, struct window_pane *wp)
+layout_assign_pane(struct layout_cell *lc, struct window_pane *wp,
+ int do_not_resize)
{
layout_make_leaf(lc, wp);
- layout_fix_panes(wp->window);
+ if (do_not_resize)
+ layout_fix_panes(wp->window, wp);
+ else
+ layout_fix_panes(wp->window, NULL);
}
/* Calculate the new pane size for resized parent. */
@@ -1040,7 +1044,7 @@ layout_close_pane(struct window_pane *wp)
/* Fix pane offsets and sizes. */
if (w->layout_root != NULL) {
layout_fix_offsets(w);
- layout_fix_panes(w);
+ layout_fix_panes(w, NULL);
}
notify_window("window-layout-changed", w);
}
@@ -1109,7 +1113,7 @@ layout_spread_out(struct window_pane *wp)
do {
if (layout_spread_cell(w, parent)) {
layout_fix_offsets(w);
- layout_fix_panes(w);
+ layout_fix_panes(w, NULL);
break;
}
} while ((parent = parent->parent) != NULL);