version 1.6, 2009/07/12 16:15:34 |
version 1.7, 2009/07/14 19:03:16 |
|
|
struct screen_write_ctx ctx; |
struct screen_write_ctx ctx; |
struct session *s = c->session; |
struct session *s = c->session; |
struct winlink *wl; |
struct winlink *wl; |
struct window_pane *wp; |
struct screen old_status; |
struct screen *sc = NULL, old_status; |
|
char *left, *right, *text, *ptr; |
char *left, *right, *text, *ptr; |
size_t llen, llen2, rlen, rlen2, offset; |
size_t llen, llen2, rlen, rlen2, offset; |
size_t xx, yy, sy, size, start, width; |
size_t xx, yy, size, start, width; |
struct grid_cell stdgc, gc; |
struct grid_cell stdgc, gc; |
int larrow, rarrow, utf8flag; |
int larrow, rarrow, utf8flag; |
|
|
left = right = NULL; |
left = right = NULL; |
|
|
|
/* No status line?*/ |
|
if (c->tty.sy == 0 || !options_get_number(&s->options, "status")) |
|
return (1); |
|
larrow = rarrow = 0; |
|
|
/* Create the target screen. */ |
/* Create the target screen. */ |
memcpy(&old_status, &c->status, sizeof old_status); |
memcpy(&old_status, &c->status, sizeof old_status); |
screen_init(&c->status, c->tty.sx, 1, 0); |
screen_init(&c->status, c->tty.sx, 1, 0); |
|
|
/* No status line? */ |
/* Create the target screen. */ |
if (c->tty.sy == 0 || !options_get_number(&s->options, "status")) |
memcpy(&old_status, &c->status, sizeof old_status); |
goto off; |
screen_init(&c->status, c->tty.sx, 1, 0); |
larrow = rarrow = 0; |
|
|
|
if (gettimeofday(&c->status_timer, NULL) != 0) |
if (gettimeofday(&c->status_timer, NULL) != 0) |
fatal("gettimeofday"); |
fatal("gettimeofday"); |
|
|
for (offset = 0; offset < c->tty.sx; offset++) |
for (offset = 0; offset < c->tty.sx; offset++) |
screen_write_putc(&ctx, &stdgc, ' '); |
screen_write_putc(&ctx, &stdgc, ' '); |
|
|
goto out; |
|
|
|
off: |
|
/* |
|
* Draw the real window last line. Necessary to wipe over message if |
|
* status is off. Not sure this is the right place for this. |
|
*/ |
|
memcpy(&stdgc, &grid_default_cell, sizeof stdgc); |
|
screen_write_start(&ctx, NULL, &c->status); |
|
|
|
sy = 0; |
|
TAILQ_FOREACH(wp, &s->curw->window->panes, entry) { |
|
sy += wp->sy + 1; |
|
sc = wp->screen; |
|
} |
|
|
|
screen_write_cursormove(&ctx, 0, 0); |
|
if (sy < c->tty.sy) { |
|
/* If the screen is too small, use blank. */ |
|
for (offset = 0; offset < c->tty.sx; offset++) |
|
screen_write_putc(&ctx, &stdgc, ' '); |
|
} else { |
|
screen_write_copy(&ctx, |
|
sc, 0, sc->grid->hsize + screen_size_y(sc) - 1, c->tty.sx, 1); |
|
} |
|
|
|
out: |
out: |
screen_write_stop(&ctx); |
screen_write_stop(&ctx); |
|
|
|
|
|
|
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
c->flags |= CLIENT_REDRAW; |
c->flags |= CLIENT_REDRAW; |
|
|
|
screen_reinit(&c->status); |
} |
} |
|
|
/* Draw client message on status line of present else on last line. */ |
/* Draw client message on status line of present else on last line. */ |
|
|
|
|
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE); |
c->flags |= CLIENT_REDRAW; |
c->flags |= CLIENT_REDRAW; |
|
|
|
screen_reinit(&c->status); |
} |
} |
|
|
/* Draw client prompt on status line of present else on last line. */ |
/* Draw client prompt on status line of present else on last line. */ |