From 248f78d29a705df9c5faa67c8ca0394fd028448a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 21 Sep 2007 18:31:58 +0000 Subject: Remove window before working out new current window; clear last window if necessary. --- session.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'session.c') diff --git a/session.c b/session.c index 432756fe..d0ebafac 100644 --- a/session.c +++ b/session.c @@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.10 2007-09-21 18:16:31 nicm Exp $ */ +/* $Id: session.c,v 1.11 2007-09-21 18:31:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -129,14 +129,13 @@ session_attach(struct session *s, struct window *w) int session_detach(struct session *s, struct window *w) { - /* Move to last, previous of next window if possible. */ + window_remove(&s->windows, w); + + if (s->last == w) + s->last = NULL; if (s->window == w && session_last(s) != 0 && session_previous(s) != 0) session_next(s); - /* Remove the window from the list. */ - window_remove(&s->windows, w); - - /* Destroy session if it is empty. */ if (!ARRAY_EMPTY(&s->windows)) return (0); session_destroy(s); -- cgit