X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fseq_msgstats.c;h=7ffbde16525236cf580832292fe85b0e83e0e05a;hp=eb483b7bd194d990af06fa7beb4d105be1a4c4d7;hb=f78e7c6e6e616cc4ff2bee8a726365fafef2d8ce;hpb=cf1205b5cbea2f0cd6ea710ec16c637df85b647c diff --git a/sbr/seq_msgstats.c b/sbr/seq_msgstats.c index eb483b7..7ffbde1 100644 --- a/sbr/seq_msgstats.c +++ b/sbr/seq_msgstats.c @@ -98,7 +98,19 @@ 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; + } + if (msgnum > mp->hghsel) { + mp->hghsel = msgnum; + } + mp->numsel++; } void @@ -119,14 +131,15 @@ void unset_selected(struct msgs *mp, int msgnum) { assert_msg_range(mp, msgnum); - mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED; -} -void -unset_unseen(struct msgs *mp, int msgnum) -{ - assert_msg_range(mp, msgnum); - mp->msgstats[msgnum - mp->lowoff] &= ~SELECT_UNSEEN; + if (!is_selected(mp, msgnum)) { + return; + } + + mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED; + if (mp->numsel > 0) { + mp->numsel--; + } }