summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-07-05 14:52:34 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-07-05 14:52:34 +0000
commit859a61c8e3f3d9df5f092fe7bdf172d3f8231600 (patch)
tree9b802c0e3ca36e26012ef8519a00c477e01cb596
parent60e7e9fc1ecec0584e083ec1ce3abeca5263abab (diff)
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.
-rw-r--r--usr.bin/tmux/server-fn.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index ca1a75ced36..17d41bcedf6 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.69 2013/04/22 13:35:18 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.70 2013/07/05 14:52:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -262,8 +262,9 @@ server_lock_client(struct client *c)
void
server_kill_window(struct window *w)
{
- struct session *s, *next_s;
- struct winlink *wl;
+ struct session *s, *next_s, *target_s;
+ struct session_group *sg;
+ struct winlink *wl;
next_s = RB_MIN(sessions, &sessions);
while (next_s != NULL) {
@@ -280,8 +281,13 @@ server_kill_window(struct window *w)
server_redraw_session_group(s);
}
- if (options_get_number(&s->options, "renumber-windows"))
- session_renumber_windows(s);
+ 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);
+ }
}
recalculate_sizes();
}