From: pdmef Date: Mon, 20 Feb 2006 15:26:45 +0000 (+0000) Subject: From: Lars Ellenberg X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=78586c1ffef95f49598e381b5cefa46765fa854f;ds=sidebyside From: Lars Ellenberg Rocco Rutte: - fix sidebar scrolling/offset issue where pointer gets hidden by status line git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@783 e385b8ad-14ed-0310-8656-cc95a2468c6d --- diff --git a/VERSION.svn b/VERSION.svn index fd394dd..634a083 100644 --- a/VERSION.svn +++ b/VERSION.svn @@ -1 +1 @@ -782 +783 diff --git a/sidebar.c b/sidebar.c index 42a3546..a0b888f 100644 --- a/sidebar.c +++ b/sidebar.c @@ -44,7 +44,7 @@ void calc_boundaries (int menu) if (TopBuffy < 0 || TopBuffy >= Incoming->length) TopBuffy = 0; - lines = LINES - 2 - (option (OPTSTATUSONTOP)); + lines = LINES - 2 - !option (OPTHELP); known_lines = lines; if (option (OPTSIDEBARNEWMAILONLY)) { int i = CurBuffy; @@ -282,12 +282,20 @@ void sidebar_set_buffystats (CONTEXT* Context) { */ int sidebar_draw (int menu) { - - int lines = option (OPTHELP) ? 1 : 0, draw_devider = 1, i = 0; + int first_line = option (OPTSTATUSONTOP) ? 1 : option (OPTHELP) ? 1 : 0; + int last_line = LINES-1; + int draw_devider = 1, i = 0; + int line; BUFFY *tmp; short delim_len = str_len (SidebarDelim); char blank[SHORT_STRING]; + if (option (OPTSTATUSONTOP)) { + last_line -= option (OPTHELP) ? 1 : 0; + } else { + last_line -= 1-(menu==MENU_PAGER); + } + /* initialize first time */ if (!initialized) { prev_show_value = option (OPTMBOXPANE); @@ -319,10 +327,8 @@ int sidebar_draw (int menu) if (draw_devider == 1){ /* draw the divider */ SETCOLOR (MT_COLOR_SIDEBAR); - for (lines = 1; - lines < LINES - 1 - (menu != MENU_PAGER || option (OPTSTATUSONTOP)); - lines++) { - move (lines, SidebarWidth - delim_len); + for (line = first_line; line < last_line; line++) { + move (line, SidebarWidth - delim_len); if (option (OPTASCIICHARS)) addstr (NONULL (SidebarDelim)); else if (!option (OPTASCIICHARS) && !str_cmp (SidebarDelim, "|")) @@ -337,12 +343,11 @@ int sidebar_draw (int menu) if (list_empty(Incoming)) return 0; - lines = option (OPTHELP) ? 1 : 0; /* go back to the top */ + line = first_line; calc_boundaries (menu); /* actually print items */ - for (i = TopBuffy; i < Incoming->length && lines < LINES - 1 - - (menu != MENU_PAGER || option (OPTSTATUSONTOP)); i++) { + for (i = TopBuffy; i < Incoming->length && line < last_line; i++) { tmp = (BUFFY*) Incoming->data[i]; if (i == CurBuffy) @@ -354,15 +359,15 @@ int sidebar_draw (int menu) else SETCOLOR (MT_COLOR_NORMAL); - move (lines, 0); - lines += make_sidebar_entry (tmp->path, i, SidebarWidth-delim_len); + move (line, 0); + line += make_sidebar_entry (tmp->path, i, SidebarWidth-delim_len); } /* fill with blanks to bottom */ memset (&blank, ' ', sizeof (blank)); SETCOLOR (MT_COLOR_NORMAL); - for (; lines < LINES - 1 - (menu != MENU_PAGER || option (OPTSTATUSONTOP)); lines++) { - move (lines, 0); + for (; line < last_line; line++) { + move (line, 0); addnstr (blank, SidebarWidth-delim_len); } return 0;