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

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