X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sidebar.c;h=42a3546bc59c29880e03ccafc8d3d2310d247a06;hp=4ea49d4ae17ec5ac28ef06959e48fdb425dfbffc;hb=5fde02cd887a4dfcc5f7f69f8b4cf950bd655219;hpb=e25811a4e3b78d25ccffcbe272b31d625138c61e diff --git a/sidebar.c b/sidebar.c index 4ea49d4..42a3546 100644 --- a/sidebar.c +++ b/sidebar.c @@ -31,7 +31,6 @@ static int CurBuffy = 0; static int known_lines = 0; static short initialized = 0; static short prev_show_value; -static short saveSidebarWidth; /* computes first entry to be shown */ void calc_boundaries (int menu) @@ -44,11 +43,8 @@ void calc_boundaries (int menu) 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)); + lines = LINES - 2 - (option (OPTSTATUSONTOP)); known_lines = lines; if (option (OPTSIDEBARNEWMAILONLY)) { int i = CurBuffy; @@ -149,6 +145,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); @@ -287,22 +291,14 @@ int sidebar_draw (int menu) /* initialize first time */ if (!initialized) { prev_show_value = option (OPTMBOXPANE); - saveSidebarWidth = SidebarWidth; - if (!option (OPTMBOXPANE)){ - SidebarWidth = 0; + if (!option (OPTMBOXPANE)) draw_devider = 1; - } initialized = 1; } /* save or restore the value SidebarWidth */ if (prev_show_value != option (OPTMBOXPANE)) { - if (prev_show_value && !option (OPTMBOXPANE)) { - saveSidebarWidth = SidebarWidth; - SidebarWidth = 0; - } - else if (!prev_show_value && option (OPTMBOXPANE)) { - SidebarWidth = saveSidebarWidth; + if (!prev_show_value && option (OPTMBOXPANE)) { /* after toggle: force recounting of all mail */ buffy_check (2); }