git: plan9front

Download patch

ref: b9955e29d1d82686979611e01a2e1f60283af58a
parent: 03cb81c7a50bf1c85fe54e05da88f8687d1e8346
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Nov 22 11:34:34 EST 2024

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.

--- a/sys/src/cmd/upas/Mail/mbox.c
+++ b/sys/src/cmd/upas/Mail/mbox.c
@@ -313,11 +313,13 @@
 {
 	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);
@@ -324,6 +326,8 @@
 	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;
 }
 
--