summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-12-20 00:17:22 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-12-20 00:17:22 +0000
commit9358cfaf4a566a060af81312ff73ee1e3e8c8ced (patch)
tree9bb80e4b6807c9b434f7b463c7caed9cdb581584 /cmd-new-session.c
parenta51dcdc430150b688d56ec35e8c96ce6f978f68b (diff)
Use pointer rather than index for the client's last session.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 573b0ebb..5511da5d 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -122,7 +122,7 @@ int
cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_new_session_data *data = self->data;
- struct session *s, *groupwith;
+ struct session *s, *old_s, *groupwith;
struct window *w;
struct window_pane *wp;
struct environ env;
@@ -279,17 +279,16 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
if (!detached) {
if (ctx->cmdclient != NULL) {
server_write_client(ctx->cmdclient, MSG_READY, NULL, 0);
- if (ctx->cmdclient->session != NULL) {
- session_index(ctx->cmdclient->session,
- &ctx->cmdclient->last_session);
- }
+
+ old_s = ctx->cmdclient->session;
+ if (old_s != NULL)
+ ctx->cmdclient->last_session = old_s;
ctx->cmdclient->session = s;
server_redraw_client(ctx->cmdclient);
} else {
- if (ctx->curclient->session != NULL) {
- session_index(ctx->curclient->session,
- &ctx->curclient->last_session);
- }
+ old_s = ctx->curclient->session;
+ if (old_s != NULL)
+ ctx->curclient->last_session = old_s;
ctx->curclient->session = s;
server_redraw_client(ctx->curclient);
}