X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fseq_msgstats.c;h=6b89d70554b7a20d9de936f3186af0330c13b85b;hp=40b84746d42df5f26109024422e6a7168d11d650;hb=1492dd50aa1043da58809ca0fec18cb6ab9937bc;hpb=0347722f5b69de06a867b73ddc23388d082ab219 diff --git a/sbr/seq_msgstats.c b/sbr/seq_msgstats.c index 40b8474..6b89d70 100644 --- a/sbr/seq_msgstats.c +++ b/sbr/seq_msgstats.c @@ -4,13 +4,14 @@ ** (These functions had once been macros in h/mh.h) */ +#include #include static void assert_msg_range(struct msgs *mp, int msgnum) { if (msgnum < mp->lowoff || msgnum > mp->hghoff) { - adios(NULL, "Bug: message out of bounds"); + adios(EX_SOFTWARE, NULL, "Bug: message out of bounds"); } } @@ -98,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 @@ -119,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