- for(c = nexttiled(clients), i = 0; c && (c != sel) && i < nmaster; c = nexttiled(c->next))
- i++;
- if(c == sel && i < nmaster)
- for(; c && i < nmaster; c = nexttiled(c->next))
- i++;
- if(!c)
- return;
+ c = sel;
+ if(n <= nmaster || (arrange == dofloat))
+ pop(c);
+ else if(ismaster(sel)) {
+ if(!(c = topofstack()))
+ return;
+ swap(c, sel);
+ c = sel;
+ }
+ else
+ pop(c);