Sync OpenBSD patchset 257:

Add a base-index session option to specify the first index checked when looking
for an index for a new window.
This commit is contained in:
Tiago Cunha
2009-08-16 19:16:27 +00:00
parent 9116905b24
commit e61ee94e26
11 changed files with 51 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-new-session.c,v 1.54 2009-08-16 19:07:40 tcunha Exp $ */
/* $Id: cmd-new-session.c,v 1.55 2009-08-16 19:16:27 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -119,7 +119,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) {
@ -217,7 +217,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);