ref: 6bbc20102b8c32cb055b22d19736820e1f987f7f
parent: cde5a56483d0abfe298adb67759daf1ce476e585
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Apr 16 17:17:22 EDT 2023
scan: skip past repeated messages on enter too
--- a/pack.c
+++ b/pack.c
@@ -214,7 +214,7 @@
p = pack32(&err, p, e, d->gid);
p = pack32(&err, p, e, d->muid);
if(err)
- abort();
+ return nil;
return p;
}
--- a/tree.c
+++ b/tree.c
@@ -1402,8 +1402,16 @@
if(p[i].vi == -1)
getval(b, ++p[i].vi, &v);
p[i].bi = bufsearch(b, &s->kv, &m, &same);
- if(p[i].bi == -1 || !same)
+ if(p[i].bi == -1 || !same || !s->first){
p[i].bi++;
+ /* scan past repeated messages */
+ while(p[i].bi < p[i].b->nbuf){
+ getmsg(p[i].b, p[i].bi, &m);
+ if(keycmp(&m, &s->kv) >= 0)
+ break;
+ p[i].bi++;
+ }
+ }
bp = getptr(&v, nil);
if((b = getblk(bp, 0)) == nil)
return Eio;