http://lists.df7cb.de/mutt/message/20050309.162127.a244a894.en.html
== END PATCH
-Index: debian-mutt/menu.c
+Index: mutt/menu.c
===================================================================
---- debian-mutt.orig/menu.c 2007-03-24 18:45:30.000000000 +0100
-+++ debian-mutt/menu.c 2007-06-28 21:48:47.000000000 +0200
-@@ -840,8 +840,12 @@ int menu_redraw (MUTTMENU *menu)
+--- mutt.orig/menu.c 2009-06-25 12:35:36.000000000 +0200
++++ mutt/menu.c 2009-06-25 12:36:19.000000000 +0200
+@@ -853,8 +853,17 @@
int mutt_menuLoop (MUTTMENU *menu)
{
+ static int last_position = -1;
int i = OP_NULL;
-+ if (menu->is_mailbox_list && last_position >= 0)
-+ menu->current = last_position;
++ if ( menu->max && menu->is_mailbox_list ) {
++ if ( last_position > (menu->max-1) ) {
++ last_position = -1;
++ } else if (last_position >= 0) {
++ menu->current = last_position;
++ }
++ }
+
FOREVER
{
if (option (OPTMENUCALLER))
-@@ -1073,6 +1077,8 @@ int mutt_menuLoop (MUTTMENU *menu)
+@@ -1082,6 +1091,8 @@
break;
default:
-+ if (menu->is_mailbox_list)
-+ last_position = menu->current;
++ if (menu->is_mailbox_list)
++ last_position = menu->current;
return (i);
}
}
-Index: debian-mutt/browser.c
+Index: mutt/browser.c
===================================================================
---- debian-mutt.orig/browser.c 2007-06-28 21:41:27.000000000 +0200
-+++ debian-mutt/browser.c 2007-06-28 21:48:47.000000000 +0200
-@@ -56,6 +56,7 @@ typedef struct folder_t
+--- mutt.orig/browser.c 2009-06-25 12:35:37.000000000 +0200
++++ mutt/browser.c 2009-06-25 12:36:19.000000000 +0200
+@@ -55,6 +55,7 @@
int num;
} FOLDER;
static char LastDir[_POSIX_PATH_MAX] = "";
static char LastDirBackup[_POSIX_PATH_MAX] = "";
-@@ -510,19 +511,38 @@ static void init_menu (struct browser_st
+@@ -519,9 +520,13 @@
menu->tagged = 0;
if (buffy)
{
+ menu->is_mailbox_list = 0;
strfcpy (path, LastDir, sizeof (path));
- mutt_pretty_mailbox (path);
+ mutt_pretty_mailbox (path, sizeof (path));
#ifdef USE_IMAP
-- if (state->imap_browse && option (OPTIMAPLSUB))
-- snprintf (title, titlelen, _("Subscribed [%s], File mask: %s"),
-- path, NONULL (Mask.pattern));
-- else
-+ if (state->imap_browse && option (OPTIMAPLSUB))
-+ snprintf (title, titlelen, _("Subscribed [%s], File mask: %s"),
-+ path, NONULL (Mask.pattern));
-+ else
+@@ -530,8 +535,22 @@
+ path, NONULL (Mask.pattern));
+ else
#endif
- snprintf (title, titlelen, _("Directory [%s], File mask: %s"),
- path, NONULL(Mask.pattern));
-+ {
-+ char *p = strrchr (OldLastDir, '/');
-+ if (p && p - OldLastDir == mutt_strlen (LastDir) &&
-+ mutt_strncmp (LastDir, OldLastDir, p - OldLastDir) == 0)
-+ {
-+ /* If we get here, it means that LastDir is the parent directory of
-+ * OldLastDir. I.e., we're returning from a subdirectory, and we want
-+ * to position the cursor on the directory we're returning from. */
-+ int i;
-+ for (i = 0; i < state->entrymax; i++)
-+ if (mutt_strcmp (state->entry[i].name, p + 1) == 0)
-+ menu->current = i;
-+ }
-+ snprintf (title, titlelen, _("Directory [%s], File mask: %s"),
-+ path, NONULL(Mask.pattern));
-+ }
-+
++ {
++ char *p = strrchr (OldLastDir, '/');
++ if (p && p - OldLastDir == mutt_strlen (LastDir) &&
++ mutt_strncmp (LastDir, OldLastDir, p - OldLastDir) == 0)
++ {
++ /* If we get here, it means that LastDir is the parent directory of
++ * OldLastDir. I.e., we're returning from a subdirectory, and we want
++ * to position the cursor on the directory we're returning from. */
++ int i;
++ for (i = 0; i < state->entrymax; i++)
++ if (mutt_strcmp (state->entry[i].name, p + 1) == 0)
++ menu->current = i;
++ }
++ snprintf (title, titlelen, _("Directory [%s], File mask: %s"),
++ path, NONULL(Mask.pattern));
++ }
}
menu->redraw = REDRAW_FULL;
}
-@@ -706,7 +726,6 @@ void _mutt_select_file (char *f, size_t
+@@ -714,7 +733,6 @@
#endif
)
{
/* save the old directory */
strfcpy (OldLastDir, LastDir, sizeof (OldLastDir));
-Index: debian-mutt/mutt_menu.h
+Index: mutt/mutt_menu.h
===================================================================
---- debian-mutt.orig/mutt_menu.h 2007-03-20 20:42:04.000000000 +0100
-+++ debian-mutt/mutt_menu.h 2007-06-28 21:48:47.000000000 +0200
-@@ -49,6 +49,7 @@ typedef struct menu_t
+--- mutt.orig/mutt_menu.h 2009-06-25 12:35:44.000000000 +0200
++++ mutt/mutt_menu.h 2009-06-25 12:36:19.000000000 +0200
+@@ -49,6 +49,7 @@
int offset; /* which screen row to start the index */
int pagelen; /* number of entries per screen */
int tagprefix;
/* Setting dialog != NULL overrides normal menu behaviour.
* In dialog mode menubar is hidden and prompt keys are checked before
-Index: debian-mutt/PATCHES
-===================================================================
---- debian-mutt.orig/PATCHES 2007-06-28 21:49:06.000000000 +0200
-+++ debian-mutt/PATCHES 2007-06-28 21:49:20.000000000 +0200
-@@ -4,3 +4,4 @@ patch-1.5.13.nt+ab.xtitles.4
- patch-1.5.6.dw.maildir-mtime.1
- patch-1.5.13.cd.ifdef.2
- patch-1.5.16.rr.compressed.1
-+patch-1.5.8.hr.sensible_browser_position.3