summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-10-23 12:51:52 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-10-23 12:51:52 +0000
commit334c76aa6164f1ff51959561a489830d601cbc69 (patch)
tree816d509dbd6ba92ee3dc3c848ecadb81b75ef1ef /usr.bin/tmux
parenteabb64e57f738d813e7306cb8dc6948504a91c63 (diff)
When removing a pane, don't change the active pane unless the active
pane is actually the one being removed.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/window.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 14749553eec..6aeee96294a 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.56 2010/10/16 08:31:55 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.57 2010/10/23 12:51:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -368,9 +368,11 @@ window_add_pane(struct window *w, u_int hlimit)
void
window_remove_pane(struct window *w, struct window_pane *wp)
{
- w->active = TAILQ_PREV(wp, window_panes, entry);
- if (w->active == NULL)
- w->active = TAILQ_NEXT(wp, entry);
+ if (wp == w->active) {
+ w->active = TAILQ_PREV(wp, window_panes, entry);
+ if (w->active == NULL)
+ w->active = TAILQ_NEXT(wp, entry);
+ }
TAILQ_REMOVE(&w->panes, wp, entry);
window_pane_destroy(wp);