aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-14 19:03:16 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-14 19:03:16 +0000
commitae2ea525752c9eb1be9e9d7b3fa71b390a70f2ec (patch)
tree073b09021533caaefe103571968213ba006f8526 /status.c
parente76caa0017795c3ec4ad9406b55f4937bf7ccae0 (diff)
downloadrtmux-ae2ea525752c9eb1be9e9d7b3fa71b390a70f2ec.tar.gz
rtmux-ae2ea525752c9eb1be9e9d7b3fa71b390a70f2ec.tar.bz2
rtmux-ae2ea525752c9eb1be9e9d7b3fa71b390a70f2ec.zip
Instead of faking up a status line in status_redraw, use the same code to
redraw it as to draw the entire screen, just skip all lines but the last. This makes horizontal split redraw properly when the status line is off.
Diffstat (limited to 'status.c')
-rw-r--r--status.c47
1 files changed, 14 insertions, 33 deletions
diff --git a/status.c b/status.c
index 6841468f..e2ffa0a7 100644
--- a/status.c
+++ b/status.c
@@ -44,24 +44,27 @@ status_redraw(struct client *c)
struct screen_write_ctx ctx;
struct session *s = c->session;
struct winlink *wl;
- struct window_pane *wp;
- struct screen *sc = NULL, old_status;
+ struct screen old_status;
char *left, *right, *text, *ptr;
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;
int larrow, rarrow, utf8flag;
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. */
memcpy(&old_status, &c->status, sizeof old_status);
screen_init(&c->status, c->tty.sx, 1, 0);
- /* No status line? */
- if (c->tty.sy == 0 || !options_get_number(&s->options, "status"))
- goto off;
- larrow = rarrow = 0;
+ /* Create the target screen. */
+ memcpy(&old_status, &c->status, sizeof old_status);
+ screen_init(&c->status, c->tty.sx, 1, 0);
if (gettimeofday(&c->status_timer, NULL) != 0)
fatal("gettimeofday");
@@ -259,32 +262,6 @@ blank:
for (offset = 0; offset < c->tty.sx; offset++)
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:
screen_write_stop(&ctx);
@@ -518,6 +495,8 @@ status_message_clear(struct client *c)
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE);
c->flags |= CLIENT_REDRAW;
+
+ screen_reinit(&c->status);
}
/* Draw client message on status line of present else on last line. */
@@ -603,6 +582,8 @@ status_prompt_clear(struct client *c)
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE);
c->flags |= CLIENT_REDRAW;
+
+ screen_reinit(&c->status);
}
/* Draw client prompt on status line of present else on last line. */