Correcting the lastsel handling in tabbed. It should be more predictable now.
This commit is contained in:
parent
5e1c53ad3c
commit
ffa2dbeb64
2
tabbed.1
2
tabbed.1
@ -65,7 +65,7 @@ move selected tab one to the left
|
|||||||
move selected tab one to the right
|
move selected tab one to the right
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl\-Tab
|
.B Ctrl\-Tab
|
||||||
toggle between tabs
|
toggle between the selected and last selected tab
|
||||||
.TP
|
.TP
|
||||||
.B Ctrl\-q
|
.B Ctrl\-q
|
||||||
close tab
|
close tab
|
||||||
|
40
tabbed.c
40
tabbed.c
@ -437,8 +437,8 @@ focus(int c) {
|
|||||||
|
|
||||||
if(sel != c)
|
if(sel != c)
|
||||||
lastsel = sel;
|
lastsel = sel;
|
||||||
|
|
||||||
sel = c;
|
sel = c;
|
||||||
|
|
||||||
drawbar();
|
drawbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,9 +682,6 @@ manage(Window w) {
|
|||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
focus((nextfocus)? 0 : ((sel < 0)? 0 : sel));
|
focus((nextfocus)? 0 : ((sel < 0)? 0 : sel));
|
||||||
nextfocus = foreground;
|
nextfocus = foreground;
|
||||||
|
|
||||||
if(lastsel < 0)
|
|
||||||
lastsel = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,45 +916,52 @@ textnw(const char *text, unsigned int len) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
unmanage(int c) {
|
unmanage(int c) {
|
||||||
int pc;
|
if(c < 0 || c >= nclients) {
|
||||||
|
drawbar();
|
||||||
if(c < 0 || c >= nclients)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!nclients) {
|
if(!nclients) {
|
||||||
return;
|
return;
|
||||||
} else if(c == 0) {
|
} else if(c == 0) {
|
||||||
/* First client. */
|
/* First client. */
|
||||||
pc = 0;
|
|
||||||
nclients--;
|
nclients--;
|
||||||
free(clients[0]);
|
free(clients[0]);
|
||||||
memmove(&clients[0], &clients[1], sizeof(Client *) * nclients);
|
memmove(&clients[0], &clients[1], sizeof(Client *) * nclients);
|
||||||
} else if(c == nclients - 1) {
|
} else if(c == nclients - 1) {
|
||||||
/* Last client. */
|
/* Last client. */
|
||||||
nclients--;
|
nclients--;
|
||||||
pc = nclients - 1;
|
|
||||||
free(clients[c]);
|
free(clients[c]);
|
||||||
clients = erealloc(clients, sizeof(Client *) * nclients);
|
clients = erealloc(clients, sizeof(Client *) * nclients);
|
||||||
} else {
|
} else {
|
||||||
/* Somewhere inbetween. */
|
/* Somewhere inbetween. */
|
||||||
pc = c + 1;
|
|
||||||
free(clients[c]);
|
free(clients[c]);
|
||||||
memmove(&clients[c], &clients[c+1],
|
memmove(&clients[c], &clients[c+1],
|
||||||
sizeof(Client *) * (nclients - (c + 1)));
|
sizeof(Client *) * (nclients - (c + 1)));
|
||||||
nclients--;
|
nclients--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c == lastsel)
|
if(c == lastsel) {
|
||||||
lastsel = 0;
|
lastsel = -1;
|
||||||
if(c == sel) {
|
} else if(lastsel > c) {
|
||||||
sel = pc;
|
lastsel--;
|
||||||
focus(lastsel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nclients == 0) {
|
if(sel > c && c > 0) {
|
||||||
if(fillagain)
|
sel--;
|
||||||
spawn(NULL);
|
lastsel = -1;
|
||||||
}
|
}
|
||||||
|
if(c == nclients && nclients > 0)
|
||||||
|
sel = nclients - 1;
|
||||||
|
|
||||||
|
if(lastsel > -1) {
|
||||||
|
focus(lastsel);
|
||||||
|
} else {
|
||||||
|
focus(sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nclients == 0 && fillagain)
|
||||||
|
spawn(NULL);
|
||||||
|
|
||||||
drawbar();
|
drawbar();
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user