If you select or unselect the same msgnum
numsel won't be increased/decreased twice.
static int m_conv(struct msgs *, char *, int);
static int attr(struct msgs *, char *);
static int m_conv(struct msgs *, char *, int);
static int attr(struct msgs *, char *);
-
-static void
-addtosel(struct msgs *mp, int msg)
-{
- if (is_selected(mp, msg)) {
- return; /* dont select twice */
- }
- set_selected(mp, msg);
-}
-
int
m_convert(struct msgs *mp, char *name)
{
int
m_convert(struct msgs *mp, char *name)
{
** Also, it is available in any folder.
*/
if ((mp->msgflags & ALLOW_BEYOND) && strcmp(cp, seq_beyond)==0) {
** Also, it is available in any folder.
*/
if ((mp->msgflags & ALLOW_BEYOND) && strcmp(cp, seq_beyond)==0) {
- addtosel(mp, getbeyond(mp));
+ set_selected(mp, getbeyond(mp));
/* Cycle through the range and select the messages that exist. */
for (found=0; first <= last; first++) {
if (does_exist(mp, first)) {
/* Cycle through the range and select the messages that exist. */
for (found=0; first <= last; first++) {
if (does_exist(mp, first)) {
+ set_selected(mp, first);
if (does_exist(mp, j)
&& inverted ? !in_sequence(mp, i, j) :
in_sequence(mp, i, j)) {
if (does_exist(mp, j)
&& inverted ? !in_sequence(mp, i, j) :
in_sequence(mp, i, j)) {
set_selected(struct msgs *mp, int msgnum)
{
assert_msg_range(mp, msgnum);
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;
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);
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--;
mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED;
if (mp->numsel > 0) {
mp->numsel--;