<<< Date Index >>>     <<< Thread Index >>>

Re: For 1.5.9: menu_move_off (was: Change in behavior <current-middle>)



On Mon, 14 Mar 2005, Alain Bench wrote:
>     BTW the 2 last points reported in <20040312134805.GA19667@xxxxxxx>
> are still valid:
> 
>  · <first-entry>, then <next-page><previous-page> fails.

That's because Mutt is unable to show you
items with less-than-zero numbers.

Mutt currently allows you to show more-than-max
as empty lines when $menu_move_off is set.
So it is natural to show less-than-zero as
empty lines.

I have a patch to make it possible. (Attached)

-- 
tamo
--- menu.c.BAK  2005-03-18 19:13:01.590677880 +0900
+++ menu.c      2005-03-18 19:14:14.600578688 +0900
@@ -209,7 +209,7 @@
 
   for (i = menu->top; i < menu->top + menu->pagelen; i++)
   {
-    if (i < menu->max)
+    if (i >= 0 && i < menu->max)
     {
       menu_make_entry (buf, sizeof (buf), menu, i);
       menu_pad_string (buf, sizeof (buf));
@@ -396,9 +396,11 @@
       menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - 
menu->current) / (menu->pagelen - c)) - c;
   }
 
-  if (!option (OPTMENUMOVEOFF)) /* make entries stick to bottom */
+  if (!option (OPTMENUMOVEOFF)) /* make entries stick to top or bottom */
+  {
     menu->top = MIN (menu->top, menu->max - menu->pagelen);
-  menu->top = MAX (menu->top, 0);
+    menu->top = MAX (menu->top, 0);
+  }
 
   if (menu->top != old_top)
     menu->redraw |= REDRAW_INDEX;
@@ -490,12 +492,9 @@
 
 void menu_prev_page (MUTTMENU *menu)
 {
-  int c = MIN (MenuContext, menu->pagelen / 2);
-
-  if (menu->top > c)
+  if (menu->top > 0)
   {
-    if ((menu->top -= menu->pagelen) < 0)
-      menu->top = 0;
+    menu->top -= menu->pagelen;
     if (menu->current >= menu->top + menu->pagelen)
       menu->current = menu->top + menu->pagelen - 1;
     menu->redraw = REDRAW_INDEX;
@@ -573,8 +572,7 @@
 {
   if (menu->top > 0)
   {
-    if ((menu->top -= menu->pagelen / 2) < 0)
-      menu->top = 0;
+    menu->top -= menu->pagelen / 2;
     if (menu->current >= menu->top + menu->pagelen)
       menu->current = menu->top + menu->pagelen - 1;
     menu->redraw = REDRAW_INDEX;
@@ -627,8 +625,6 @@
   if (menu->max)
   {
     menu->top = menu->current - menu->pagelen / 2;
-    if (menu->top < 0)
-      menu->top = 0;
     menu->redraw = REDRAW_INDEX;
   }
   else
@@ -640,8 +636,6 @@
   if (menu->max)
   {
     menu->top = menu->current - menu->pagelen + 1;
-    if (menu->top < 0)
-      menu->top = 0;
     menu->redraw = REDRAW_INDEX;
   }
   else