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

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



On Sat, 19 Mar 2005, Alain Bench wrote:
> Hi Tamo-san!

Hi Alain,


>  On Friday, March 18, 2005 at 8:04:18 PM +0900, Tamotsu Takahashi wrote:
> 
> > On Mon, 14 Mar 2005, Alain Bench wrote:
> >> <first-entry>, then <next-page><previous-page> fails.
> > That's because Mutt is unable to show you items with less-than-zero
> > numbers.
> 
>     Thanks for the patch! There is a glitch: When in threaded index,
> subjects of replies randomly appear and disappear while you scroll past
> top. And I'm not sure if allowing top unstuck menus is usefull.

Uggh. Forget my patch then.
I won't fix the bug in my patch, as no one seems interested. ;)


>     Sorry, I was too short. What I meant, written one year ago when
> $menu_context was named $index_context and not yet included in Mutt,
> was:
> 
> | There is an annoying interaction with page jumps near top of index:
> | Like with $[menu]_context=7 and $menu_scroll=yes do a <first-entry>
> | then <next-page><previous-page> in index: You should see top page
> | again, say lines #1 to #34. But you see lines #8 to #41.

Ah, I got it.
Please try this (attached) patch, named menu.diff.1.
This should fix it.

And menu.diff.2 should fix <next-page>.
i.e. <last-entry><previous-page><next-page>
should give you the last entry.

Bye,
-- 
tamo
--- menu.c.BAK  2005-03-18 19:13:01.000000000 +0900
+++ menu.c      2005-03-19 21:07:18.049485600 +0900
@@ -494,10 +494,11 @@
 
   if (menu->top > c)
   {
-    if ((menu->top -= menu->pagelen) < 0)
+    int pos = menu->top - menu->current;
+    if ((menu->current -= menu->pagelen) < 0)
+      menu->current = 0;
+    if ((menu->top = menu->current - pos) < 0)
       menu->top = 0;
-    if (menu->current >= menu->top + menu->pagelen)
-      menu->current = menu->top + menu->pagelen - 1;
     menu->redraw = REDRAW_INDEX;
   }
   else if (menu->current && !menu->dialog)
--- menu.c.1    2005-03-19 21:51:11.001655640 +0900
+++ menu.c      2005-03-19 21:51:42.113925856 +0900
@@ -467,13 +467,16 @@
 
 void menu_next_page (MUTTMENU *menu)
 {
+  int c = MIN (MenuContext, menu->pagelen / 2);
+
   if (menu->max)
   {
-    if (menu->top + menu->pagelen < menu->max)
+    if ((menu->top + menu->pagelen) < (menu->max - c))
     {
-      menu->top += menu->pagelen;
-      if (menu->current < menu->top)
-       menu->current = menu->top;
+      int pos = menu->top - menu->current;
+      if ((menu->current += menu->pagelen) > (menu->max - 1))
+       menu->current = menu->max - 1;
+      menu->top = menu->current - pos;
       menu->redraw = REDRAW_INDEX;
     }
     else if (menu->current != menu->max - 1 && !menu->dialog)