Skip to content

Commit

Permalink
Show initial message in copy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nviennot committed Nov 6, 2019
1 parent 442143c commit 9781946
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tmate-msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
5 changes: 5 additions & 0 deletions tmate-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9781946

Please sign in to comment.