mirror of
https://github.com/tmux/tmux.git
synced 2025-09-03 14:27:09 +00:00
Merge branch 'obsd-master'
This commit is contained in:
17
layout.c
17
layout.c
@ -1101,7 +1101,7 @@ layout_spread_cell(struct window *w, struct layout_cell *parent)
|
|||||||
{
|
{
|
||||||
struct layout_cell *lc;
|
struct layout_cell *lc;
|
||||||
struct style *sb_style = &w->active->scrollbar_style;
|
struct style *sb_style = &w->active->scrollbar_style;
|
||||||
u_int number, each, size, this;
|
u_int number, each, size, this, remainder;
|
||||||
int change, changed, status, scrollbars;
|
int change, changed, status, scrollbars;
|
||||||
|
|
||||||
number = 0;
|
number = 0;
|
||||||
@ -1130,20 +1130,31 @@ layout_spread_cell(struct window *w, struct layout_cell *parent)
|
|||||||
each = (size - (number - 1)) / number;
|
each = (size - (number - 1)) / number;
|
||||||
if (each == 0)
|
if (each == 0)
|
||||||
return (0);
|
return (0);
|
||||||
|
/*
|
||||||
|
* Remaining space after assigning that which can be evenly
|
||||||
|
* distributed.
|
||||||
|
*/
|
||||||
|
remainder = size - (number * (each + 1)) + 1;
|
||||||
|
|
||||||
changed = 0;
|
changed = 0;
|
||||||
TAILQ_FOREACH (lc, &parent->cells, entry) {
|
TAILQ_FOREACH (lc, &parent->cells, entry) {
|
||||||
if (TAILQ_NEXT(lc, entry) == NULL)
|
|
||||||
each = size - ((each + 1) * (number - 1));
|
|
||||||
change = 0;
|
change = 0;
|
||||||
if (parent->type == LAYOUT_LEFTRIGHT) {
|
if (parent->type == LAYOUT_LEFTRIGHT) {
|
||||||
change = each - (int)lc->sx;
|
change = each - (int)lc->sx;
|
||||||
|
if (remainder > 0) {
|
||||||
|
change++;
|
||||||
|
remainder--;
|
||||||
|
}
|
||||||
layout_resize_adjust(w, lc, LAYOUT_LEFTRIGHT, change);
|
layout_resize_adjust(w, lc, LAYOUT_LEFTRIGHT, change);
|
||||||
} else if (parent->type == LAYOUT_TOPBOTTOM) {
|
} else if (parent->type == LAYOUT_TOPBOTTOM) {
|
||||||
if (layout_add_horizontal_border(w, lc, status))
|
if (layout_add_horizontal_border(w, lc, status))
|
||||||
this = each + 1;
|
this = each + 1;
|
||||||
else
|
else
|
||||||
this = each;
|
this = each;
|
||||||
|
if (remainder > 0) {
|
||||||
|
this++;
|
||||||
|
remainder--;
|
||||||
|
}
|
||||||
change = this - (int)lc->sy;
|
change = this - (int)lc->sy;
|
||||||
layout_resize_adjust(w, lc, LAYOUT_TOPBOTTOM, change);
|
layout_resize_adjust(w, lc, LAYOUT_TOPBOTTOM, change);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user