Show initial message in copy mode

This commit is contained in:
Nicolas Viennot 2019-11-05 21:32:21 -05:00
parent 442143cd90
commit 9781946a70
2 changed files with 25 additions and 0 deletions

View File

@ -50,6 +50,24 @@ static void tmate_status_message_client(struct client *c, const char *message)
recalculate_sizes();
}
static void tmate_status_message_session(const char *message)
{
if (tmate_foreground)
return;
struct session *s;
s = RB_MIN(sessions, &sessions);
if (!s) {
cfg_add_cause("%s", message);
return;
}
struct window_pane *wp;
wp = s->curw->window->active;
if (wp->mode == &window_copy_mode)
window_copy_add(wp, "%s", message);
}
void __tmate_status_message(const char *fmt, va_list ap)
{
struct client *c;
@ -63,6 +81,8 @@ void __tmate_status_message(const char *fmt, va_list ap)
tmate_status_message_client(c, message);
}
tmate_status_message_session(message);
free(message);
}

View File

@ -190,6 +190,11 @@ void tmate_session_start(void)
* - While we are parsing the config file, we need to be able to
* serialize it, and so we need a worker encoder.
*/
if (!tmate_foreground) {
cfg_add_cause("%s", "To see these messages again, run: tmate show-messages");
cfg_add_cause("%s", "-----------------------------------------------------");
}
send_authorized_keys();
tmate_write_ready();
lookup_and_connect();