Instead of numbering session groups, give them a name which may be given

to -t instead of a target session. Also allow them to contain only one
session.
This commit is contained in:
nicm
2017-02-09 15:04:53 +00:00
parent 8de4c15dfa
commit c6a3446398
8 changed files with 135 additions and 85 deletions

View File

@ -78,7 +78,7 @@ server_redraw_session_group(struct session *s)
{
struct session_group *sg;
if ((sg = session_group_find(s)) == NULL)
if ((sg = session_group_contains(s)) == NULL)
server_redraw_session(s);
else {
TAILQ_FOREACH(s, &sg->sessions, gentry)
@ -102,7 +102,7 @@ server_status_session_group(struct session *s)
{
struct session_group *sg;
if ((sg = session_group_find(s)) == NULL)
if ((sg = session_group_contains(s)) == NULL)
server_status_session(s);
else {
TAILQ_FOREACH(s, &sg->sessions, gentry)
@ -220,7 +220,7 @@ server_kill_window(struct window *w)
}
if (options_get_number(s->options, "renumber-windows")) {
if ((sg = session_group_find(s)) != NULL) {
if ((sg = session_group_contains(s)) != NULL) {
TAILQ_FOREACH(target_s, &sg->sessions, gentry)
session_renumber_windows(target_s);
} else
@ -238,8 +238,8 @@ server_link_window(struct session *src, struct winlink *srcwl,
struct winlink *dstwl;
struct session_group *srcsg, *dstsg;
srcsg = session_group_find(src);
dstsg = session_group_find(dst);
srcsg = session_group_contains(src);
dstsg = session_group_contains(dst);
if (src != dst && srcsg != NULL && dstsg != NULL && srcsg == dstsg) {
xasprintf(cause, "sessions are grouped");
return (-1);
@ -348,7 +348,7 @@ server_destroy_session_group(struct session *s)
struct session_group *sg;
struct session *s1;
if ((sg = session_group_find(s)) == NULL)
if ((sg = session_group_contains(s)) == NULL)
server_destroy_session(s);
else {
TAILQ_FOREACH_SAFE(s, &sg->sessions, gentry, s1) {