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