X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sidebar.c;h=9290a1a0ae52dae5d61a10c2f37834926b1dcf40;hp=bcaa0a7d1d5a26d684799657b2f26de5c7180ff9;hb=58fbf95737a7601f6e139e39b9f69d102c7e858d;hpb=254adb836d2349416af564eec8280dc83ef9fc1b diff --git a/sidebar.c b/sidebar.c index bcaa0a7..9290a1a 100644 --- a/sidebar.c +++ b/sidebar.c @@ -66,19 +66,20 @@ void calc_boundaries (int menu) tmp = Incoming; while (tmp != CurBuffy) { - position++; - tmp = tmp->next; + position++; + tmp = tmp->next; } // calculate the size of the screen we can use count = LINES - 2 - (menu != MENU_PAGER || option (OPTSTATUSONTOP)); // calculate the position of the current mailbox on the screen mailbox_position = position%count; + if (mailbox_position == 0) mailbox_position=count; // determine topbuffy TopBuffy = CurBuffy; for(i = mailbox_position; i >1; i--) TopBuffy = TopBuffy->prev; // determine bottombuffy BottomBuffy = CurBuffy; - for(i = mailbox_position; i <= count && BottomBuffy->next; i++) BottomBuffy = BottomBuffy->next; + for(i = mailbox_position; i < count && BottomBuffy->next; i++) BottomBuffy = BottomBuffy->next; } static char * shortened_hierarchy(char * box) {