Fix squash-groups skipping every session, GitHub issue 5180 from Bryce

Miller.
This commit is contained in:
nicm
2026-06-08 21:46:19 +00:00
parent 4d1ab1ba2a
commit a6a06c5aa6

View File

@@ -355,6 +355,7 @@ window_tree_build(void *modedata, struct sort_criteria *sort_crit,
uint64_t *tag, const char *filter) uint64_t *tag, const char *filter)
{ {
struct window_tree_modedata *data = modedata; struct window_tree_modedata *data = modedata;
int squash_groups = data->squash_groups;
struct session *s, **l; struct session *s, **l;
struct session_group *sg, *current; struct session_group *sg, *current;
u_int n, i; 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); l = sort_get_sessions(&n, sort_crit);
if (n == 0) if (n == 0)
return; return;
s = l[n - 1];
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (data->squash_groups && s = l[i];
(sg = session_group_contains(s)) != NULL) { if (squash_groups && (sg = session_group_contains(s)) != NULL) {
if ((sg == current && s != data->fs.s) || if ((sg == current && s != data->fs.s) ||
(sg != current && s != TAILQ_FIRST(&sg->sessions))) (sg != current && s != TAILQ_FIRST(&sg->sessions)))
continue; continue;
} }
window_tree_build_session(l[i], modedata, sort_crit, filter); window_tree_build_session(s, modedata, sort_crit, filter);
} }
switch (data->type) { switch (data->type) {