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.
---
 server-fn.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/server-fn.c b/server-fn.c
index 7ef6413..86e2054 100644
--- a/server-fn.c
+++ b/server-fn.c
@@ -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();
 }
-- 
1.8.3.1


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to