Select previous tag if try to select current one (in order to improve erufu productivity)

This commit is contained in:
Martin Duquesnoy 2012-01-21 00:48:35 +01:00
parent 682bbeea89
commit 1376bfebe1

View File

@ -26,6 +26,7 @@ tag_new(struct screen *s, char *name)
t->flags = 0; t->flags = 0;
t->id = 0; t->id = 0;
t->sel = NULL; t->sel = NULL;
t->prev = NULL;
if((l = TAILQ_LAST(&s->tags, tsub))) if((l = TAILQ_LAST(&s->tags, tsub)))
t->id = l->id + 1; t->id = l->id + 1;
@ -41,6 +42,9 @@ tag_new(struct screen *s, char *name)
void void
tag_screen(struct screen *s, struct tag *t) tag_screen(struct screen *s, struct tag *t)
{ {
if(t == s->seltag)
t = t->prev;
if(!t) if(!t)
t = TAILQ_FIRST(&s->tags); t = TAILQ_FIRST(&s->tags);
@ -122,7 +126,7 @@ uicb_tag_set(Uicb cmd)
struct tag *t; struct tag *t;
TAILQ_FOREACH(t, &W->screen->tags, next) TAILQ_FOREACH(t, &W->screen->tags, next)
if(i++ == n && t != W->screen->seltag) if(i++ == n)
{ {
tag_screen(W->screen, t); tag_screen(W->screen, t);
return; return;
@ -135,7 +139,7 @@ uicb_tag_set_with_name(Uicb cmd)
struct tag *t; struct tag *t;
TAILQ_FOREACH(t, &W->screen->tags, next) TAILQ_FOREACH(t, &W->screen->tags, next)
if(!strcmp(cmd, t->name) && t != W->screen->seltag) if(!strcmp(cmd, t->name))
{ {
tag_screen(W->screen, t); tag_screen(W->screen, t);
return; return;