summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-13 20:11:58 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-13 20:11:58 +0000
commit3ad4de6c8cbdc767c6ac40b99764cc7bd8db066a (patch)
tree542f3ff53b0bc779bf29cb1ca1483e3636a86255 /cmd-new-session.c
parent3026118c702fc0f17b860197b5242816927bbadb (diff)
Add a base-index session option to specify the first index checked when looking
for an index for a new window.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 64337e6d..ff90e3be 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -118,7 +118,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
struct termios tio;
const char *update;
char *overrides, *cmd, *cwd, *cause;
- int detached;
+ int detached, idx;
u_int sx, sy;
if (data->newname != NULL && session_find(data->newname) != NULL) {
@@ -216,7 +216,9 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
tio.c_ospeed = TTYDEF_SPEED;
/* Create the new session. */
- s = session_create(data->newname, cmd, cwd, &env, &tio, sx, sy, &cause);
+ idx = -1 - options_get_number(&global_s_options, "base-index");
+ s = session_create(
+ data->newname, cmd, cwd, &env, &tio, idx, sx, sy, &cause);
if (s == NULL) {
ctx->error(ctx, "create session failed: %s", cause);
xfree(cause);