summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-02-06 17:15:33 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-02-06 17:15:33 +0000
commit8aba77b7be489a93dc843d7ef4378bd73b5385b1 (patch)
tree060d27ad5846fc444116eb205f9b2b72c186717f /cmd-new-session.c
parent5e6a7c85ccdbabda01e7c05a10f7bd8dcee47e70 (diff)
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 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 461e0391..20ef8d65 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -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 */
}