/* computes first entry to be shown */
void calc_boundaries (int menu)
{
- int lines = 0;
if (list_empty(Incoming))
return;
if (TopBuffy < 0 || TopBuffy >= Incoming->length)
TopBuffy = 0;
- lines = LINES - 2 - !option (OPTHELP);
- known_lines = lines;
if (option (OPTSIDEBARNEWMAILONLY)) {
int i = CurBuffy;
TopBuffy = CurBuffy - 1;
i--;
}
} else
- TopBuffy = CurBuffy - (CurBuffy % lines);
+ TopBuffy = CurBuffy - (CurBuffy % known_lines);
if (TopBuffy < 0)
TopBuffy = 0;
}
last_line -= 1-(menu==MENU_PAGER);
}
+ known_lines=last_line-first_line;
+
/* initialize first time */
if (!initialized) {
prev_show_value = option (OPTMBOXPANE);
initialized = 1;
}
+ if (TopBuffy==0 || CurBuffy==0)
+ calc_boundaries(menu);
+
/* save or restore the value SidebarWidth */
if (prev_show_value != option (OPTMBOXPANE)) {
if (!prev_show_value && option (OPTMBOXPANE)) {
if (list_empty(Incoming))
return 0;
- line = first_line;
- calc_boundaries (menu);
/* actually print items */
- for (i = TopBuffy; i < Incoming->length && line < last_line; i++) {
+ for (i = TopBuffy, line=first_line; i < Incoming->length && line < last_line; i++) {
tmp = (BUFFY*) Incoming->data[i];
if (i == CurBuffy)