summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-new-session.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-02-06 17:15:33 +0000
committernicm <nicm@openbsd.org>2010-02-06 17:15:33 +0000
commit9a53e128e82783ea59ef6d1323ae061f893b30e7 (patch)
tree73d3f8459a72afb2915c00727c817b42d2bf3e7c /usr.bin/tmux/cmd-new-session.c
parentwhen receiving the first message of an rsn group key handshake (diff)
downloadwireguard-openbsd-9a53e128e82783ea59ef6d1323ae061f893b30e7.tar.xz
wireguard-openbsd-9a53e128e82783ea59ef6d1323ae061f893b30e7.zip
Instead of bailing out on the first configuration file error, carry on,
collecting all the errors, then start with the active window in more mode displaying them.
Diffstat (limited to 'usr.bin/tmux/cmd-new-session.c')
-rw-r--r--usr.bin/tmux/cmd-new-session.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index e17b2d8c01f..660072645a6 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.25 2009/12/03 22:50:10 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.26 2010/02/06 17:15:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -122,12 +122,13 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
struct cmd_new_session_data *data = self->data;
struct session *s, *groupwith;
struct window *w;
+ struct window_pane *wp;
struct environ env;
struct termios tio, *tiop;
const char *update;
char *overrides, *cmd, *cwd, *cause;
int detached, idx;
- u_int sx, sy;
+ u_int sx, sy, i;
if (data->newname != NULL && session_find(data->newname) != NULL) {
ctx->error(ctx, "duplicate session: %s", data->newname);
@@ -280,6 +281,21 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
recalculate_sizes();
server_update_socket();
+ /*
+ * If there are still configuration file errors to display, put the new
+ * session's current window into more mode and display them now.
+ */
+ if (cfg_finished && cfg_ncauses != 0) {
+ wp = s->curw->window->active;
+ window_pane_set_mode(wp, &window_more_mode);
+ for (i = 0; i < cfg_ncauses; i++) {
+ window_more_add(wp, "%s", cfg_causes[i]);
+ xfree(cfg_causes[i]);
+ }
+ xfree(cfg_causes);
+ cfg_ncauses = 0;
+ }
+
return (!detached); /* 1 means don't tell command client to exit */
}