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;
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--;