handle hghsel lowsel and numsel in (un)set_selected
[mmh] / sbr / seq_msgstats.c
index eb483b7..6b89d70 100644 (file)
@@ -99,6 +99,13 @@ set_selected(struct msgs *mp, int msgnum)
 {
        assert_msg_range(mp, msgnum);
        mp->msgstats[msgnum - mp->lowoff] |= SELECTED;
+       if (mp->lowsel == 0 || msgnum < mp->lowsel) {
+               mp->lowsel = msgnum;
+       }
+       if (msgnum > mp->hghsel) {
+               mp->hghsel = msgnum;
+       }
+       mp->numsel++;
 }
 
 void
@@ -120,6 +127,9 @@ unset_selected(struct msgs *mp, int msgnum)
 {
        assert_msg_range(mp, msgnum);
        mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED;
+       if (mp->numsel > 0) {
+               mp->numsel--;
+       }
 }
 
 void