From: Kevin McCarthy Date: Sat, 9 Jul 2016 01:52:56 +0000 (-0700) Subject: Change sidebar highlighted mailbox behavior. X-Git-Tag: neomutt-20160822~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8dbe6371b7531d2f915c35c196b507bc61de36b4;p=neomutt Change sidebar highlighted mailbox behavior. Delay selecting the highlighted mailbox until prepare_mailbox(), to avoid a hidden mailbox being selected during the Buffy list population (in mutt_sb_notify_mailbox()). Change update_entries_visibility() to not automatically make the highlighted mailbox visible. Change prepare_sidebar() to (re)set the highlighted mailbox when the current highlighted mailbox is hidden. --- diff --git a/sidebar.c b/sidebar.c index e710b6727..9169fca76 100644 --- a/sidebar.c +++ b/sidebar.c @@ -303,7 +303,7 @@ static void update_entries_visibility (void) continue; if ((i == OpnIndex) || (sbe->buffy->msg_unread > 0) || sbe->buffy->new || - (i == HilIndex) || (sbe->buffy->msg_flagged > 0)) + (sbe->buffy->msg_flagged > 0)) continue; if (Context && (mutt_strcmp (sbe->buffy->realpath, Context->realpath) == 0)) @@ -410,7 +410,8 @@ static int prepare_sidebar (int page_size) HilIndex = i; } - if ((HilIndex < 0) || (SidebarSortMethod != PreviousSort)) + if ((HilIndex < 0) || Entries[HilIndex]->is_hidden || + (SidebarSortMethod != PreviousSort)) { if (OpnIndex >= 0) HilIndex = OpnIndex; @@ -1008,8 +1009,6 @@ void mutt_sb_notify_mailbox (BUFFY *b, int created) if (TopIndex < 0) TopIndex = EntryCount; - if (HilIndex < 0) - HilIndex = EntryCount; if (BotIndex < 0) BotIndex = EntryCount; if ((OpnIndex < 0) && Context &&