Nico Golde:
authornion <nion@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 28 Feb 2005 22:33:02 +0000 (22:33 +0000)
committernion <nion@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Mon, 28 Feb 2005 22:33:02 +0000 (22:33 +0000)
plastic surgery on boundary condition

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@122 e385b8ad-14ed-0310-8656-cc95a2468c6d

sidebar.c

index bcaa0a7..9290a1a 100644 (file)
--- 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) {