From a058cf74a5606e52a0318668738ac8802a815849 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 29 May 2017 20:41:29 +0000 Subject: [PATCH] Store a copy of the old status line, will be needed soon for new choose mode. --- usr.bin/tmux/options-table.c | 10 +++++----- usr.bin/tmux/server-client.c | 6 +++++- usr.bin/tmux/status.c | 21 ++++++++++++++++++++- usr.bin/tmux/tmux.h | 4 +++- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index 122a713ca43..aaecc902472 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.86 2017/01/24 20:15:32 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.87 2017/05/29 20:41:29 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -125,7 +125,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_ARRAY, .scope = OPTIONS_TABLE_SERVER, .default_str = "xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007" - ":Cs=\\E]12;%p1%s\\007:Cr=\\E]112\\007" + ":Cs=\\E]12;%p1%s\\007:Cr=\\E]112\\007" ":Ss=\\E[%p1%d q:Se=\\E[2 q,screen*:XT", .separator = "," }, @@ -485,7 +485,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_ARRAY, .scope = OPTIONS_TABLE_SESSION, .default_str = "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID " - "SSH_CONNECTION WINDOWID XAUTHORITY" + "SSH_CONNECTION WINDOWID XAUTHORITY" }, { .name = "visual-activity", @@ -540,7 +540,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_WINDOW, .default_str = "#{?pane_in_mode,[tmux],#{pane_current_command}}" - "#{?pane_dead,[dead],}" + "#{?pane_dead,[dead],}" }, { .name = "clock-mode-colour", @@ -698,7 +698,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_WINDOW, .default_str = "#{?pane_active,#[reverse],}#{pane_index}#[default] " - "\"#{pane_title}\"" + "\"#{pane_title}\"" }, { .name = "pane-border-status", diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 81218e893dd..e3208958f79 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.233 2017/05/29 20:37:30 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.234 2017/05/29 20:41:29 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -275,6 +275,10 @@ server_client_lost(struct client *c) if (event_initialized(&c->status_timer)) evtimer_del(&c->status_timer); screen_free(&c->status); + if (c->old_status != NULL) { + screen_free(c->old_status); + free(c->old_status); + } free(c->title); free((void *)c->cwd); diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index cca0ef0db01..2021385ad11 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.166 2017/05/17 15:20:23 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.167 2017/05/29 20:41:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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); @@ -671,6 +684,12 @@ status_prompt_set(struct client *c, const char *msg, const char *input, 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); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 7316d3f6711..c80806506cf 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.772 2017/05/29 20:37:30 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.773 2017/05/29 20:41:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1328,6 +1328,8 @@ struct client { struct event status_timer; struct screen status; + struct screen *old_status; + #define CLIENT_TERMINAL 0x1 #define CLIENT_LOGIN 0x2 #define CLIENT_EXIT 0x4 -- 2.20.1