From: Michael Elkins Date: Tue, 15 Jan 2013 03:23:06 +0000 (-0800) Subject: allow use of sync-mailbox when the current limit has no visible messages X-Git-Tag: neomutt-20160307~183 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e25a9bb1a12c4e61c8e76fdb4fab3e7e598e7c9;p=neomutt allow use of sync-mailbox when the current limit has no visible messages closes #3538 --- diff --git a/curs_main.c b/curs_main.c index b9e34bd58..aa4b044d6 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1011,7 +1011,6 @@ int mutt_index_menu (void) break; CHECK_MSGCOUNT; - CHECK_VISIBLE; CHECK_READONLY; { int oldvcount = Context->vcount; @@ -1019,15 +1018,19 @@ int mutt_index_menu (void) int check, newidx; HEADER *newhdr = NULL; - /* threads may be reordered, so figure out what header the cursor - * should be on. #3092 */ - newidx = menu->current; - if (CURHDR->deleted) - newidx = ci_next_undeleted (menu->current); - if (newidx < 0) - newidx = ci_previous_undeleted (menu->current); - if (newidx >= 0) - newhdr = Context->hdrs[Context->v2r[newidx]]; + /* don't attempt to move the cursor if there are no visible messages in the current limit */ + if (menu->current < Context->vcount) + { + /* threads may be reordered, so figure out what header the cursor + * should be on. #3092 */ + newidx = menu->current; + if (CURHDR->deleted) + newidx = ci_next_undeleted (menu->current); + if (newidx < 0) + newidx = ci_previous_undeleted (menu->current); + if (newidx >= 0) + newhdr = Context->hdrs[Context->v2r[newidx]]; + } if ((check = mx_sync_mailbox (Context, &index_hint)) == 0) {