From: Pierre Habouzit Date: Sun, 12 Aug 2007 08:34:19 +0000 (+0200) Subject: Fix sidebar to always show ^. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=17a1c26c692a1863e76dba05db16c4eba6d8abe8;p=apps%2Fmadmutt.git Fix sidebar to always show ^. Also some minor fixes. Signed-off-by: Pierre Habouzit --- diff --git a/lib-ui/sidebar.c b/lib-ui/sidebar.c index 7c7d6b3..7de8d22 100644 --- a/lib-ui/sidebar.c +++ b/lib-ui/sidebar.c @@ -190,7 +190,8 @@ static int make_sidebar_entry(WINDOW *sw, char *sbox, int idx, ssize_t len) int l_m = m_strlen(Maildir); if (option(OPTSIDEBARNEWMAILONLY) && sbox && Context && Context->path - && m_strcmp(Context->path, sbox) && Incoming.arr[idx]->new == 0) + && m_strcmp(Context->path, sbox) && Incoming.arr[idx]->new == 0 + && idx != CurBuffy) return 0; m_strformat(no, sizeof(no), len, SidebarNumberFormat, @@ -227,9 +228,9 @@ static int make_sidebar_entry(WINDOW *sw, char *sbox, int idx, ssize_t len) */ const char *sidebar_get_current(void) { - if (!Incoming.len) - return NULL; - return Incoming.arr[CurBuffy]->path; + if (0 <= CurBuffy && CurBuffy < Incoming.len) + return Incoming.arr[CurBuffy]->path; + return NULL; } /* internally sets item to buf */ @@ -244,16 +245,18 @@ void sidebar_set_current(const char* buf) /* fix counters for a context * FIXME since ctx must not be of our business, move it elsewhere */ -void sidebar_set_buffystats (CONTEXT* curContext) { - int i = 0; - BUFFY* tmp = NULL; - if (!curContext || !Incoming.len || (i = buffy_lookup (curContext->path)) < 0) - return; - tmp = Incoming.arr[i]; - tmp->new = curContext->new; - tmp->msg_unread = curContext->unread; - tmp->msgcount = curContext->msgcount; - tmp->msg_flagged = curContext->flagged; +void sidebar_set_buffystats(CONTEXT *curContext) +{ + int i = 0; + BUFFY *tmp; + + if (!curContext || (i = buffy_lookup(curContext->path)) < 0) + return; + tmp = Incoming.arr[i]; + tmp->new = curContext->new; + tmp->msg_unread = curContext->unread; + tmp->msgcount = curContext->msgcount; + tmp->msg_flagged = curContext->flagged; } int sidebar_draw(void)