When the session option renumber-window is used, ensure we iterate over

all sessions in that group when the winlinks are reordered, otherwise
the winlink lists are out of sync with one another. From Thomas Adam.
This commit is contained in:
Nicholas Marriott 2013-07-05 14:52:33 +00:00
parent 7af5fec038
commit 064124cc5f

View File

@ -262,7 +262,8 @@ server_lock_client(struct client *c)
void void
server_kill_window(struct window *w) server_kill_window(struct window *w)
{ {
struct session *s, *next_s; struct session *s, *next_s, *target_s;
struct session_group *sg;
struct winlink *wl; struct winlink *wl;
next_s = RB_MIN(sessions, &sessions); next_s = RB_MIN(sessions, &sessions);
@ -280,9 +281,14 @@ server_kill_window(struct window *w)
server_redraw_session_group(s); server_redraw_session_group(s);
} }
if (options_get_number(&s->options, "renumber-windows")) if (options_get_number(&s->options, "renumber-windows")) {
if ((sg = session_group_find(s)) != NULL) {
TAILQ_FOREACH(target_s, &sg->sessions, gentry)
session_renumber_windows(target_s);
} else
session_renumber_windows(s); session_renumber_windows(s);
} }
}
recalculate_sizes(); recalculate_sizes();
} }