]> git.marmaro.de Git - mmh/blobdiff - sbr/seq_msgstats.c
check for (un)selection befor (un)set
[mmh] / sbr / seq_msgstats.c
index 6b89d70554b7a20d9de936f3186af0330c13b85b..50ae7c68f582f6833cff6818e7284785d8439158 100644 (file)
@@ -98,6 +98,11 @@ void
 set_selected(struct msgs *mp, int msgnum)
 {
        assert_msg_range(mp, msgnum);
+
+       if (is_selected(mp, msgnum)) {
+               return;
+       }
+
        mp->msgstats[msgnum - mp->lowoff] |= SELECTED;
        if (mp->lowsel == 0 || msgnum < mp->lowsel) {
                mp->lowsel = msgnum;
@@ -126,6 +131,11 @@ void
 unset_selected(struct msgs *mp, int msgnum)
 {
        assert_msg_range(mp, msgnum);
+
+       if (!is_selected(mp, msgnum)) {
+               return;
+       }
+
        mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED;
        if (mp->numsel > 0) {
                mp->numsel--;