summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-12-22 15:31:00 +0000
committerTiago Cunha <tcunha@gmx.com>2010-12-22 15:31:00 +0000
commitbb728b89a7b0e0f1921c336d3f25ab0ee02322f8 (patch)
tree7b130934f4b366ad4094dc66a1a85dbc4e74dcf9 /cmd-new-session.c
parent64d16cf2d67c42642401cd0bbaeb278a1c00822a (diff)
Sync OpenBSD patchset 802:
Use pointer rather than index for the client's last session.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index d09e2e7d..4e5192bd 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-session.c,v 1.79 2010-12-11 18:42:20 nicm Exp $ */
+/* $Id: cmd-new-session.c,v 1.80 2010-12-22 15:31:00 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
}