upas/Mail: don't move cursor when flags are unchanged

when doing bulk operations one after the other, like
mass-marking messages read, the cursor tends to jump
to update the messages, but they're already in the
right state; don't do that.
This commit is contained in:
Ori Bernstein 2024-11-22 16:34:34 +00:00
parent 03cb81c7a5
commit b9955e29d1

View file

@ -313,17 +313,21 @@ change(char *name, char *digest)
{
Mesg *m;
char *f;
int old;
if((m = mesglookup(name, digest)) == nil)
return nil;
if((f = rslurp(m, "flags", nil)) == nil)
return nil;
old = m->flags;
free(m->mflags);
m->mflags = f;
m->flags &= ~(Fdel|Fseen|Fresp);
if(strchr(m->mflags, 'd')) m->flags |= Fdel;
if(strchr(m->mflags, 's')) m->flags |= Fseen;
if(strchr(m->mflags, 'a')) m->flags |= Fresp;
if(old == m->flags)
return nil;
return m;
}