X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/78077051deed41adf786e1f5f4397dadf3012956..fb164ff46f3e5e352f800367f9d7f555b19d666f:/debian/patches/features/sensible_browser_position?ds=sidebyside diff --git a/debian/patches/features/sensible_browser_position b/debian/patches/features/sensible_browser_position index 0b424e4..cf8cc7b 100644 --- a/debian/patches/features/sensible_browser_position +++ b/debian/patches/features/sensible_browser_position @@ -7,31 +7,36 @@ This is the sensible browser position patch by Haakon Riiser. == END PATCH --- a/menu.c +++ b/menu.c -@@ -840,8 +840,12 @@ int menu_redraw (MUTTMENU *menu) +@@ -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); } } --- a/browser.c +++ b/browser.c -@@ -56,6 +56,7 @@ typedef struct folder_t +@@ -56,6 +56,7 @@ int num; } FOLDER; @@ -39,7 +44,7 @@ This is the sensible browser position patch by Haakon Riiser. static char LastDir[_POSIX_PATH_MAX] = ""; static char LastDirBackup[_POSIX_PATH_MAX] = ""; -@@ -506,19 +507,38 @@ static void init_menu (struct browser_st +@@ -526,9 +527,13 @@ menu->tagged = 0; if (buffy) @@ -51,40 +56,34 @@ This is the sensible browser position patch by Haakon Riiser. { + 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 +@@ -537,8 +542,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; } -@@ -694,7 +714,6 @@ void _mutt_select_file (char *f, size_t +@@ -721,7 +740,6 @@ #endif ) { @@ -94,7 +93,7 @@ This is the sensible browser position patch by Haakon Riiser. strfcpy (OldLastDir, LastDir, sizeof (OldLastDir)); --- a/mutt_menu.h +++ b/mutt_menu.h -@@ -49,6 +49,7 @@ typedef struct menu_t +@@ -49,6 +49,7 @@ int offset; /* which screen row to start the index */ int pagelen; /* number of entries per screen */ int tagprefix; @@ -102,10 +101,3 @@ This is the sensible browser position patch by Haakon Riiser. /* Setting dialog != NULL overrides normal menu behaviour. * In dialog mode menubar is hidden and prompt keys are checked before ---- a/PATCHES -+++ b/PATCHES -@@ -3,3 +3,4 @@ patch-1.5.13.cd.purge_message.3.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.8.hr.sensible_browser_position.3