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

Re: mutt/2019: menu_context itches (Re: your mail)



* Wed Aug 10 2005 Brendan Cully <brendan@xxxxxxxxxx>
> On Wednesday, 10 August 2005 at 16:59, Alain Bench wrote:
> >  On Tuesday, August 9, 2005 at 10:31:02 PM -0700, Brendan Cully wrote:
> > 
> >     [patch-1.5.9.tamo.menu_onlybug.1]
> > > with $menu_context="0", $menu_move_off="no" (the mutt I grew up with).
> > 
> >     I assume you mean $menu_move_off="yes", the unique behaviour of
> > historic Mutt until 1.5.7 included.
> 
> quite right, sorry about that.

Ah, I see.


> > > <first-entry><last-entry> no longer produces the same screen as
> > > <first-entry><next-page><next-page>... until the last page.
> > 
> >     Same screen with $menu_move_off="no": A screenfull of entries.
> > 
> >     Different screens with $menu_move_off="yes" or legacy Mutt:
> > <last-entry> produces a screenfull of entries, while <next-page>s
> > produce a random partial end screen.
> > 
> >     I believe that when one does a <last-entry>, one expects a full
> > screen. Or maybe a partial screen, with a configurable amount of empty
> > lines below indicator (margin). Nobody expects to obtain a totally
> > random number of entries (between 1 and hight), like one can have with
> > PageDowns.
> 
> In fact I do :)
> 
> More precisely, I expect the same screen that greeted me when I first
> opened the mailbox. I found the legacy behaviour very intuitive, as
> strange as it may sound to you. And I'd really like the default set of
> options to keep things exactly the way they were back in the 1.5.7
> days.
> 
> What Tamo's patch produce for me was a screen with only one entry at
> the very top. To me that's pessimal. A full screen I could probably
> live with, although I prefer the symmetry of the old behaviour.

Okay, apparently I modified mutt's behaviour too much.
But, IIRC, that was necessary. (Maybe for mutt/2019 itself?)

So, I've made a patch to (hopefully) correct "<last-entry>"
and "opening a box". Attached.

Or someone may be able to correct menu_check_recenter() more
efficiently than I.

-- 
tamo
--- menu.c.0811 Thu Aug 11 08:21:00 2005
+++ menu.c      Thu Aug 11 09:09:54 2005
@@ -594,6 +594,15 @@ void menu_last_entry (MUTTMENU *menu)
   {
     menu->current = menu->max - 1;
     menu->redraw = REDRAW_MOTION;
+
+    /* keep the traditional behavior: the same as
+     * <first-entry><next-page><next-page>...
+     */
+    if (menu->top < menu->current - (menu->pagelen - 1))
+    {
+      menu->top = (menu->max / menu->pagelen) * menu->pagelen;
+      menu->redraw = REDRAW_INDEX;
+    }
   }
   else
     mutt_error _("No entries.");
--- curs_main.c~        Tue Aug  9 12:56:25 2005
+++ curs_main.c Thu Aug 11 10:18:03 2005
@@ -367,7 +367,10 @@ static void update_index (MUTTMENU *menu
   }
   
   if (menu->current < 0)
+  {
     menu->current = ci_first_message ();
+    menu->top = (menu->current / menu->pagelen) * menu->pagelen;
+  }
   
 }
 
@@ -393,7 +396,10 @@ static void resort_index (MUTTMENU *menu
     menu->current = mutt_parent_message (Context, current);
   
   if (menu->current < 0)
+  {
     menu->current = ci_first_message ();
+    menu->top = (menu->current / menu->pagelen) * menu->pagelen;
+  }
   
   menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
 }
@@ -437,6 +443,7 @@ int mutt_index_menu (void)
   menu->make_entry = index_make_entry;
   menu->color = index_color;
   menu->current = ci_first_message ();
+  menu->top = (menu->current / menu->pagelen) * menu->pagelen;
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, 
IndexHelp);
   
   if (!attach_msg) 
@@ -1033,7 +1040,10 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
           */
 
          if (menu->current < 0 || menu->current >= Context->vcount)
+         {
            menu->current = ci_first_message ();
+           menu->top = (menu->current / menu->pagelen) * menu->pagelen;
+         }
        }
 
        /* check for a fatal error, or all messages deleted */
@@ -1117,6 +1127,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
                                        M_READONLY : 0, NULL)) != NULL)
        {
          menu->current = ci_first_message ();
+         menu->top = (menu->current / menu->pagelen) * menu->pagelen;
        }
        else
          menu->current = 0;