Simplifying the lastsel handling a bit.
Some checks and comments were removed to simplify the function.
This commit is contained in:
parent
4ed0a2da67
commit
030eda81cc
27
tabbed.c
27
tabbed.c
|
@ -1059,9 +1059,10 @@ unmanage(int c) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!nclients) {
|
if(!nclients)
|
||||||
return;
|
return;
|
||||||
} else if(c == 0) {
|
|
||||||
|
if(c == 0) {
|
||||||
/* First client. */
|
/* First client. */
|
||||||
nclients--;
|
nclients--;
|
||||||
free(clients[0]);
|
free(clients[0]);
|
||||||
|
@ -1080,35 +1081,25 @@ unmanage(int c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nclients <= 0) {
|
if(nclients <= 0) {
|
||||||
sel = -1;
|
lastsel = sel = -1;
|
||||||
lastsel = -1;
|
|
||||||
|
|
||||||
if (closelastclient) {
|
if(closelastclient) {
|
||||||
running = False;
|
running = False;
|
||||||
} else if (fillagain && running) {
|
} else if(fillagain && running) {
|
||||||
spawn(NULL);
|
spawn(NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(c && lastsel >= nclients) {
|
if(lastsel >= nclients) {
|
||||||
lastsel = nclients - 1;
|
lastsel = nclients - 1;
|
||||||
} else if(lastsel > c) {
|
} else if(lastsel > c) {
|
||||||
lastsel--;
|
lastsel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c == sel) {
|
if(c == sel) {
|
||||||
/* Note that focus() will never set lastsel == sel,
|
focus(lastsel);
|
||||||
* so if here lastsel == sel, it was decreased by above if() clause
|
|
||||||
* and was actually (sel + 1) before.
|
|
||||||
*/
|
|
||||||
if(lastsel > 0) {
|
|
||||||
focus(lastsel);
|
|
||||||
} else {
|
|
||||||
focus(0);
|
|
||||||
lastsel = 1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(sel > c)
|
if(sel > c)
|
||||||
sel -= 1;
|
sel--;
|
||||||
if(sel >= nclients)
|
if(sel >= nclients)
|
||||||
sel = nclients - 1;
|
sel = nclients - 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue