]> git.marmaro.de Git - mmh/blobdiff - sbr/seq_msgstats.c
handle hghsel lowsel and numsel in (un)set_selected
[mmh] / sbr / seq_msgstats.c
index eb483b7bd194d990af06fa7beb4d105be1a4c4d7..6b89d70554b7a20d9de936f3186af0330c13b85b 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