diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-11-19 10:38:07 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-11-19 10:38:07 +0000 |
commit | 626370e443be224485126237f266f893a45c3fc3 (patch) | |
tree | 3e127cfa64ca27657687355a7102cb899fa2073e /usr.bin/tmux/cmd-new-session.c | |
parent | ef9b90f8e9aa2aa28bdd213adde953f06fdede51 (diff) |
Use a utility function for common code to show errors in config file,
from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/cmd-new-session.c')
-rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 8c43d1f42c9..01076dc6e42 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.45 2012/07/11 07:10:15 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.46 2012/11/19 10:38:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -58,14 +58,13 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct args *args = self->args; struct session *s, *old_s, *groupwith; struct window *w; - struct window_pane *wp; struct environ env; struct termios tio, *tiop; struct passwd *pw; const char *newname, *target, *update, *cwd, *errstr; char *cmd, *cause; int detached, idx; - u_int sx, sy, i; + u_int sx, sy; newname = args_get(args, 's'); if (newname != NULL) { @@ -257,17 +256,8 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx) * 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 && !ARRAY_EMPTY(&cfg_causes)) { - wp = s->curw->window->active; - window_pane_set_mode(wp, &window_copy_mode); - window_copy_init_for_output(wp); - for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) { - cause = ARRAY_ITEM(&cfg_causes, i); - window_copy_add(wp, "%s", cause); - free(cause); - } - ARRAY_FREE(&cfg_causes); - } + if (cfg_finished) + show_cfg_causes(s); return (detached ? CMD_RETURN_NORMAL : CMD_RETURN_ATTACH); } |