mirror of
https://github.com/tmux/tmux.git
synced 2024-11-17 18:08:51 +00:00
Fix size check for splitw -f and top level pane size for tiled layout,
problems reported by Thomas Sattler.
This commit is contained in:
parent
481c3f3f2e
commit
73b54a0e5f
@ -450,8 +450,7 @@ layout_set_tiled(struct window *w)
|
|||||||
/* Free old tree and create a new root. */
|
/* Free old tree and create a new root. */
|
||||||
layout_free(w);
|
layout_free(w);
|
||||||
lc = w->layout_root = layout_create_cell(NULL);
|
lc = w->layout_root = layout_create_cell(NULL);
|
||||||
layout_set_size(lc, (width + 1) * columns - 1,
|
layout_set_size(lc, w->sx, w->sy, 0, 0);
|
||||||
(height + 1) * rows - 1, 0, 0);
|
|
||||||
layout_make_node(lc, LAYOUT_TOPBOTTOM);
|
layout_make_node(lc, LAYOUT_TOPBOTTOM);
|
||||||
|
|
||||||
/* Create a grid of the cells. */
|
/* Create a grid of the cells. */
|
||||||
|
13
layout.c
13
layout.c
@ -736,6 +736,9 @@ layout_set_size_check(struct window *w, struct layout_cell *lc,
|
|||||||
|
|
||||||
/* Check new size will work for each child. */
|
/* Check new size will work for each child. */
|
||||||
if (lc->type == type) {
|
if (lc->type == type) {
|
||||||
|
if (available < (count * 2) - 1)
|
||||||
|
return (0);
|
||||||
|
|
||||||
if (type == LAYOUT_LEFTRIGHT)
|
if (type == LAYOUT_LEFTRIGHT)
|
||||||
previous = lc->sx;
|
previous = lc->sx;
|
||||||
else
|
else
|
||||||
@ -745,13 +748,17 @@ layout_set_size_check(struct window *w, struct layout_cell *lc,
|
|||||||
TAILQ_FOREACH(lcchild, &lc->cells, entry) {
|
TAILQ_FOREACH(lcchild, &lc->cells, entry) {
|
||||||
new_size = layout_new_pane_size(w, previous, lcchild,
|
new_size = layout_new_pane_size(w, previous, lcchild,
|
||||||
type, size, count - idx, available);
|
type, size, count - idx, available);
|
||||||
|
if (idx == count - 1) {
|
||||||
if (new_size > available)
|
if (new_size > available)
|
||||||
return (0);
|
return (0);
|
||||||
|
available -= new_size;
|
||||||
available -= (new_size + 1);
|
} else {
|
||||||
|
if (new_size + 1 > available)
|
||||||
|
return (0);
|
||||||
|
available -= new_size + 1;
|
||||||
|
}
|
||||||
if (!layout_set_size_check(w, lcchild, type, new_size))
|
if (!layout_set_size_check(w, lcchild, type, new_size))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user