diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-11-02 18:43:52 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-11-02 18:43:52 +0000 |
commit | 080b2623b686636593a98b127a2b317f300c2e8e (patch) | |
tree | ac6c8a90bedb6110b02d1ce01824a1c529a07e30 /usr.bin | |
parent | 9e6371cb8e9e93df926bbe4acde7582fc1a6b39a (diff) |
Tweak previous slightly so that current session is chosen if it is in
the group rather than first.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/format.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/window-tree.c | 14 |
2 files changed, 14 insertions, 7 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 9dcca0e2810..a64b735b097 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.148 2017/11/02 18:27:35 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.149 2017/11/02 18:43:51 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -795,8 +795,11 @@ format_find(struct format_tree *ft, const char *key, int modifiers) found = s; goto found; } - if (fe->value == NULL && fe->cb != NULL) + if (fe->value == NULL && fe->cb != NULL) { fe->cb(ft, fe); + if (fe->value == NULL) + fe->value = xstrdup(""); + } found = fe->value; goto found; } diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c index b650ce49caa..f696dd75189 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.23 2017/11/02 18:27:35 nicm Exp $ */ +/* $OpenBSD: window-tree.c,v 1.24 2017/11/02 18:43:51 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -399,9 +399,11 @@ window_tree_build(void *modedata, u_int sort_type, uint64_t *tag, { struct window_tree_modedata *data = modedata; struct session *s, **l; - struct session_group *sg; + struct session_group *sg, *current; u_int n, i; + current = session_group_contains(data->fs.s); + for (i = 0; i < data->item_size; i++) window_tree_free_item(data->item_list[i]); free(data->item_list); @@ -412,9 +414,11 @@ window_tree_build(void *modedata, u_int sort_type, uint64_t *tag, n = 0; RB_FOREACH(s, sessions, &sessions) { if (data->squash_groups && - (sg = session_group_contains(s)) != NULL && - s != TAILQ_FIRST(&sg->sessions)) - continue; + (sg = session_group_contains(s)) != NULL) { + if ((sg == current && s != data->fs.s) || + (sg != current && s != TAILQ_FIRST(&sg->sessions))) + continue; + } l = xreallocarray(l, n + 1, sizeof *l); l[n++] = s; } |