Do not include status line in size calculations in control mode.

This commit is contained in:
Nicholas Marriott 2013-03-21 18:46:12 +00:00
parent d4785fe798
commit 49ac5b5fe0

View File

@ -50,9 +50,11 @@ recalculate_sizes(void)
struct window *w;
struct window_pane *wp;
u_int i, j, ssx, ssy, has, limit;
int flag;
int flag, has_status;
RB_FOREACH(s, sessions, &sessions) {
has_status = options_get_number(&s->options, "status");
ssx = ssy = UINT_MAX;
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
c = ARRAY_ITEM(&clients, j);
@ -61,7 +63,11 @@ recalculate_sizes(void)
if (c->session == s) {
if (c->tty.sx < ssx)
ssx = c->tty.sx;
if (c->tty.sy < ssy)
if (has_status &&
!(c->flags & CLIENT_CONTROL) &&
c->tty.sy > 1 && c->tty.sy - 1 < ssy)
ssy = c->tty.sy - 1;
else if (c->tty.sy < ssy)
ssy = c->tty.sy;
}
}
@ -71,17 +77,14 @@ recalculate_sizes(void)
}
s->flags &= ~SESSION_UNATTACHED;
if (options_get_number(&s->options, "status")) {
if (ssy == 0)
if (has_status && ssy == 0)
ssy = 1;
else
ssy--;
}
if (s->sx == ssx && s->sy == ssy)
continue;
log_debug(
"session size %u,%u (was %u,%u)", ssx, ssy, s->sx, s->sy);
log_debug("session size %u,%u (was %u,%u)", ssx, ssy, s->sx,
s->sy);
s->sx = ssx;
s->sy = ssy;
@ -121,8 +124,8 @@ recalculate_sizes(void)
if (w->sx == ssx && w->sy == ssy)
continue;
log_debug(
"window size %u,%u (was %u,%u)", ssx, ssy, w->sx, w->sy);
log_debug("window size %u,%u (was %u,%u)", ssx, ssy, w->sx,
w->sy);
layout_resize(w, ssx, ssy);
window_resize(w, ssx, ssy);