diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-05-30 00:01:14 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-05-30 00:01:14 +0100 |
commit | 0d073907b59b93532f202275a95bd5064341fa01 (patch) | |
tree | 155c9464115bfb27e260a49061fe71944203198d /status.c | |
parent | 5ee6dc21201323fd1954c618311b233af8273543 (diff) | |
parent | 64552ae304109c00a47e4f62875f6e1ce707e099 (diff) | |
download | rtmux-0d073907b59b93532f202275a95bd5064341fa01.tar.gz rtmux-0d073907b59b93532f202275a95bd5064341fa01.tar.bz2 rtmux-0d073907b59b93532f202275a95bd5064341fa01.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'status.c')
-rw-r--r-- | status.c | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -301,6 +301,13 @@ status_redraw(struct client *c) size_t llen, rlen, seplen; int larrow, rarrow; + /* Delete the saved status line, if any. */ + if (c->old_status != NULL) { + screen_free(c->old_status); + free(c->old_status); + c->old_status = NULL; + } + /* No status line? */ if (c->tty.sy == 0 || !options_get_number(s->options, "status")) return (1); @@ -568,6 +575,12 @@ status_message_set(struct client *c, const char *fmt, ...) status_message_clear(c); + if (c->old_status == NULL) { + c->old_status = xmalloc(sizeof *c->old_status); + memcpy(c->old_status, &c->status, sizeof *c->old_status); + screen_init(&c->status, c->tty.sx, 1, 0); + } + va_start(ap, fmt); xvasprintf(&c->message_string, fmt, ap); va_end(ap); @@ -664,13 +677,24 @@ status_prompt_set(struct client *c, const char *msg, const char *input, ft = format_create(c, NULL, FORMAT_NONE, 0); format_defaults(ft, c, NULL, NULL, NULL); - t = time(NULL); - tmp = format_expand_time(ft, input, t); + + if (input == NULL) + input = ""; + if (flags & PROMPT_NOFORMAT) + tmp = xstrdup(input); + else + tmp = format_expand_time(ft, input, t); status_message_clear(c); status_prompt_clear(c); + if (c->old_status == NULL) { + c->old_status = xmalloc(sizeof *c->old_status); + memcpy(c->old_status, &c->status, sizeof *c->old_status); + screen_init(&c->status, c->tty.sx, 1, 0); + } + c->prompt_string = format_expand_time(ft, msg, t); c->prompt_buffer = utf8_fromcstr(tmp); |