diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-03-16 17:53:56 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-03-16 17:53:56 +0000 |
commit | 38f9e3e9e140c3733ce243f1ce820b51410606a2 (patch) | |
tree | 32ecf421307f04409b94eba0831aad6073846aea /usr.bin/tmux/status.c | |
parent | b12b5b87ce69f36884891690268e3d0b6d824166 (diff) |
Give status_save_old the client so it can do the reinit too.
Diffstat (limited to 'usr.bin/tmux/status.c')
-rw-r--r-- | usr.bin/tmux/status.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index c8beb5a1c4e..06656f6db2a 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.187 2019/03/16 17:14:07 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.188 2019/03/16 17:53:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -323,18 +323,23 @@ status_free(struct client *c) /* Save as old status line. */ static void -status_save_old(struct status_line *sl) +status_save_old(struct client *c) { + struct status_line *sl = &c->status; + if (sl->old_screen == NULL) { sl->old_screen = xmalloc(sizeof *sl->old_screen); memcpy(sl->old_screen, &sl->screen, sizeof *sl->old_screen); + screen_init(&c->status.screen, c->tty.sx, 1, 0); } } /* Free old status line. */ static void -status_free_old(struct status_line *sl) +status_free_old(struct client *c) { + struct status_line *sl = &c->status; + if (sl->old_screen != NULL) { screen_free(sl->old_screen); free(sl->old_screen); @@ -361,7 +366,7 @@ status_redraw(struct client *c) int larrow, rarrow; /* Delete the saved status line, if any. */ - status_free_old(sl); + status_free_old(c); /* No status line? */ lines = status_line_size(c); @@ -629,9 +634,7 @@ status_message_set(struct client *c, const char *fmt, ...) int delay; status_message_clear(c); - - status_save_old(&c->status); - screen_init(&c->status.screen, c->tty.sx, 1, 0); + status_save_old(c); va_start(ap, fmt); xvasprintf(&c->message_string, fmt, ap); @@ -744,9 +747,7 @@ status_prompt_set(struct client *c, const char *msg, const char *input, status_message_clear(c); status_prompt_clear(c); - - status_save_old(&c->status); - screen_init(&c->status.screen, c->tty.sx, 1, 0); + status_save_old(c); c->prompt_string = format_expand_time(ft, msg); |