Patch for mutt 1.5.8 that makes it remember menu position
I created a trivial patch to make mutt remember its last position
in the mailbox menu (mutt -y) when returning from a mailbox.
I don't think testing the menu title is a particularly elegant
method for determining the context of menuLoop(), but I saw no
better way first glance. The patch appears to work though, so I'm
posting it here for comments and criticism.
--- mutt-1.5.8/menu.c.orig 2005-02-12 21:01:55.000000000 +0100
+++ mutt-1.5.8/menu.c 2005-03-01 20:15:12.000000000 +0100
@@ -841,8 +841,14 @@
int mutt_menuLoop (MUTTMENU *menu)
{
+ static int last_position = -1;
int i = OP_NULL;
+ if (menu->title && strncmp("Mailboxes", menu->title, 9) == 0 &&
+ last_position >= 0) {
+ menu->current = last_position;
+ }
+
FOREVER
{
if (option (OPTMENUCALLER))
@@ -1068,6 +1074,9 @@
break;
default:
+ if (menu->title && strncmp("Mailboxes", menu->title, 9) == 0) {
+ last_position = menu->current;
+ }
return (i);
}
}
--
Haakon