X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sidebar.c;h=92a0d2a06c4c9e046b11c0d4d890599e3a651732;hp=ba4d4a49a2b965fbdb60177ad05981c7f95e1635;hb=23265c6d12ecb744cb38689e9d78a448089ac351;hpb=6763f237f2dfe6467cb6308e6735bab6b09d212b diff --git a/sidebar.c b/sidebar.c index ba4d4a4..92a0d2a 100644 --- a/sidebar.c +++ b/sidebar.c @@ -40,10 +40,14 @@ void calc_boundaries (int menu) if (list_empty(Incoming)) return; + if (CurBuffy < 0 || CurBuffy >= Incoming->length) + CurBuffy = 0; + if (TopBuffy < 0 || TopBuffy >= Incoming->length) + TopBuffy = 0; /* correct known_lines if it has changed because of a window resize */ /* if (known_lines != LINES) known_lines = LINES; */ - + lines = LINES - 2 - (menu != MENU_PAGER || option (OPTSTATUSONTOP)); known_lines = lines; if (option (OPTSIDEBARNEWMAILONLY)) { @@ -145,6 +149,14 @@ static const char* sidebar_number_format (char* dest, size_t destlen, char op, break; /* new */ case 'n': + if (!opt) { + snprintf (tmp, sizeof (tmp), "%%%sd", fmt); + snprintf (dest, destlen, tmp, c ? Context->new : b->new); + } else if ((c && Context->new == 0) || (!c && b->new == 0)) + opt = 0; + break; + /* unread */ + case 'u': if (!opt) { snprintf (tmp, sizeof (tmp), "%%%sd", fmt); snprintf (dest, destlen, tmp, c ? Context->unread : b->msg_unread); @@ -209,13 +221,16 @@ int make_sidebar_entry (char* box, int idx, size_t len) #if USE_IMAP if (l > 0 && str_ncmp (box, ImapHomeNamespace, l) == 0 && str_len (box) > l) - box += l + 1; + box += l + 1; /* we're trimming the ImapHomeNamespace, the "+ 1" is for the separator */ else #endif if (l_m > 0 && str_ncmp (box, Maildir, l_m) == 0 && - str_len (box) > l_m) - box += l_m + 1; - else + str_len (box) > l_m) { + box += l_m; + if (Maildir[strlen(Maildir)-1]!='/') { + box += 1; + } + } else box = basename (box); if (option (OPTSHORTENHIERARCHY) && str_len (box) > len-lencnt-1) {