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:
Nicholas Marriott
2009-08-13 20:11:58 +00:00
parent 3026118c70
commit 3ad4de6c8c
11 changed files with 40 additions and 20 deletions

View File

@ -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);