From cd1cface29b015e634e4e66a2c0a2d0c63ca992e Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 8 Jun 2026 21:46:19 +0000 Subject: [PATCH] Fix squash-groups skipping every session, GitHub issue 5180 from Bryce Miller. --- usr.bin/tmux/window-tree.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c index 15e15ea73b7..700ceeb94b4 100644 --- a/usr.bin/tmux/window-tree.c +++ b/usr.bin/tmux/window-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-tree.c,v 1.78 2026/06/08 21:01:33 nicm Exp $ */ +/* $OpenBSD: window-tree.c,v 1.79 2026/06/08 21:46:19 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott @@ -355,6 +355,7 @@ window_tree_build(void *modedata, struct sort_criteria *sort_crit, uint64_t *tag, const char *filter) { struct window_tree_modedata *data = modedata; + int squash_groups = data->squash_groups; struct session *s, **l; struct session_group *sg, *current; u_int n, i; @@ -370,15 +371,14 @@ window_tree_build(void *modedata, struct sort_criteria *sort_crit, l = sort_get_sessions(&n, sort_crit); if (n == 0) return; - s = l[n - 1]; for (i = 0; i < n; i++) { - if (data->squash_groups && - (sg = session_group_contains(s)) != NULL) { + s = l[i]; + if (squash_groups && (sg = session_group_contains(s)) != NULL) { if ((sg == current && s != data->fs.s) || (sg != current && s != TAILQ_FIRST(&sg->sessions))) continue; } - window_tree_build_session(l[i], modedata, sort_crit, filter); + window_tree_build_session(s, modedata, sort_crit, filter); } switch (data->type) {