Ensure we don't action on the last group when the requested one is not found.

This commit is contained in:
okan 2019-02-28 23:20:52 +00:00
parent 8cd6d1154c
commit 880b5cda3f

14
group.c
View File

@ -160,16 +160,15 @@ group_movetogroup(struct client_ctx *cc, int idx)
return; return;
TAILQ_FOREACH(gc, &sc->groupq, entry) { TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx) if (gc->num == idx) {
break;
}
if (cc->gc == gc) if (cc->gc == gc)
return; return;
if (gc->num != 0 && group_holds_only_hidden(gc)) if (gc->num != 0 && group_holds_only_hidden(gc))
client_hide(cc); client_hide(cc);
group_assign(gc, cc); group_assign(gc, cc);
} }
}
}
void void
group_toggle_membership(struct client_ctx *cc) group_toggle_membership(struct client_ctx *cc)
@ -221,10 +220,7 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
return; return;
TAILQ_FOREACH(gc, &sc->groupq, entry) { TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx) if (gc->num == idx) {
break;
}
if (group_holds_only_hidden(gc)) if (group_holds_only_hidden(gc))
group_show(gc); group_show(gc);
else { else {
@ -234,6 +230,8 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
group_setactive(gc); group_setactive(gc);
} }
} }
}
}
void void
group_only(struct screen_ctx *sc, int idx) group_only(struct screen_ctx *sc, int idx)