Movestack wrap overflow

This commit is contained in:
2026-04-12 21:07:21 +02:00
parent ab636d5fc3
commit 7d1a34e011
+8 -3
View File
@@ -3109,17 +3109,22 @@ movestack(const Arg *arg)
if (!sel || !selmon || !selmon->lt[selmon->sellt]->arrange || sel->isfloating)
return;
int wrap = 0;
if (arg->i > 0) {
wl_list_for_each(c, &sel->link, link) {
if (&c->link == &clients)
if (&c->link == &clients) {
wrap = 1;
continue;
}
if (VISIBLEON(c, selmon) && !c->isfloating)
break;
}
} else {
wl_list_for_each_reverse(c, &sel->link, link) {
if (&c->link == &clients)
if (&c->link == &clients) {
wrap = 1;
continue;
}
if (VISIBLEON(c, selmon) && !c->isfloating)
break;
}
@@ -3127,7 +3132,7 @@ movestack(const Arg *arg)
if (c == sel)
return;
wl_list_remove(&sel->link);
if (arg->i > 0)
if ((arg->i > 0) ^ wrap)
wl_list_insert(&c->link, &sel->link);
else
wl_list_insert(c->link.prev, &sel->link);