mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
session_last == -1 could still leave us with the window we are about to remove.
This commit is contained in:
parent
1702a781bb
commit
d63977ea8a
10
session.c
10
session.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: session.c,v 1.9 2007-09-20 18:03:23 nicm Exp $ */
|
/* $Id: session.c,v 1.10 2007-09-21 18:16:31 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -129,11 +129,11 @@ session_attach(struct session *s, struct window *w)
|
|||||||
int
|
int
|
||||||
session_detach(struct session *s, struct window *w)
|
session_detach(struct session *s, struct window *w)
|
||||||
{
|
{
|
||||||
if (s->window == w) {
|
/* Move to last, previous of next window if possible. */
|
||||||
if (session_last(s) == -1)
|
if (s->window == w && session_last(s) != 0 && session_previous(s) != 0)
|
||||||
session_previous(s);
|
session_next(s);
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Remove the window from the list. */
|
||||||
window_remove(&s->windows, w);
|
window_remove(&s->windows, w);
|
||||||
|
|
||||||
/* Destroy session if it is empty. */
|
/* Destroy session if it is empty. */
|
||||||
|
Loading…
Reference in New Issue
Block a user