From: Kevin McCarthy Date: Mon, 27 Mar 2017 01:31:39 +0000 (-0700) Subject: Add a menu stack to track current and past menus. X-Git-Tag: neomutt-20170414~18^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f69d354e1e5e4d2b3b804698546bcb8c83c6a920;p=neomutt Add a menu stack to track current and past menus. Change the pager to use a MENU, right now just to hold the refresh state. --- diff --git a/addrbook.c b/addrbook.c index 50e19fadb..67f822965 100644 --- a/addrbook.c +++ b/addrbook.c @@ -151,6 +151,7 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases) menu->tag = alias_tag; menu->title = _("Aliases"); menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_ALIAS, AliasHelp); + mutt_push_current_menu (menu); new_aliases: @@ -234,6 +235,7 @@ new_aliases: rfc822_write_address (buf, buflen, AliasTable[t]->addr, 1); } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); FREE (&AliasTable); diff --git a/browser.c b/browser.c index 12075c7b6..e73a66f9e 100644 --- a/browser.c +++ b/browser.c @@ -1258,6 +1258,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num option (OPTNEWS) ? FolderNewsHelp : #endif FolderHelp); + mutt_push_current_menu (menu); init_menu (&state, menu, title, sizeof (title), buffy); @@ -1451,7 +1452,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num } destroy_state (&state); - mutt_menu_destroy (&menu); goto bail; case OP_BROWSER_TELL: @@ -1620,7 +1620,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num mutt_error (_("Error scanning directory.")); if (examine_directory (menu, &state, LastDir, prefix) == -1) { - mutt_menu_destroy (&menu); goto bail; } } @@ -1690,7 +1689,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num else { mutt_error (_("Error scanning directory.")); - mutt_menu_destroy (&menu); goto bail; } killPrefix = 0; @@ -1827,7 +1825,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { strfcpy (f, buf, flen); destroy_state (&state); - mutt_menu_destroy (&menu); goto bail; } MAYBE_REDRAW (menu->redraw); @@ -1845,7 +1842,6 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { strfcpy (f, state.entry[menu->current].name, flen); destroy_state (&state); - mutt_menu_destroy (&menu); goto bail; } else @@ -2052,6 +2048,12 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num bail: + if (menu) + { + mutt_pop_current_menu (menu); + mutt_menu_destroy (&menu); + } + if (GotoSwapper[0]) GotoSwapper[0] = '\0'; } diff --git a/compose.c b/compose.c index ab6120297..f08f5e2ad 100644 --- a/compose.c +++ b/compose.c @@ -573,6 +573,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ else #endif menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeHelp); + mutt_push_current_menu (menu); while (loop) { @@ -1494,6 +1495,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ } } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); if (idxlen) diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 789d67e53..4eda2771d 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -4007,6 +4007,7 @@ static crypt_key_t *crypt_select_key (crypt_key_t *keys, menu->make_entry = crypt_entry; menu->help = helpstr; menu->data = key_table; + mutt_push_current_menu (menu); { const char *ts = NULL; @@ -4115,6 +4116,7 @@ static crypt_key_t *crypt_select_key (crypt_key_t *keys, } } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); FREE (&key_table); diff --git a/curs_main.c b/curs_main.c index 592c3a81d..9758c753d 100644 --- a/curs_main.c +++ b/curs_main.c @@ -842,6 +842,7 @@ int mutt_index_menu (void) (Context && (Context->magic == MUTT_NNTP)) ? IndexNewsHelp : #endif IndexHelp); + mutt_push_current_menu (menu); if (!attach_msg) mutt_buffy_check(1); /* force the buffy check after we enter the folder */ @@ -3229,6 +3230,7 @@ int mutt_index_menu (void) if (done) break; } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); return close; } diff --git a/menu.c b/menu.c index 3679d423b..f0e8f0b67 100644 --- a/menu.c +++ b/menu.c @@ -27,6 +27,11 @@ char* SearchBuffers[MENU_MAX]; +/* These are used to track the active menus, for redraw operations. */ +static size_t MenuStackCount = 0; +static size_t MenuStackLen = 0; +static MUTTMENU **MenuStack = NULL; + static int get_color (int index, unsigned char *s) { @@ -774,6 +779,7 @@ MUTTMENU *mutt_new_menu (int menu) p->messagewin = MuttMessageWindow; p->color = default_color; p->search = menu_search_generic; + return p; } @@ -792,6 +798,30 @@ void mutt_menu_destroy (MUTTMENU **p) FREE (p); /* __FREE_CHECKED__ */ } +void mutt_push_current_menu (MUTTMENU *menu) +{ + if (MenuStackCount >= MenuStackLen) + { + MenuStackLen += 5; + safe_realloc (&MenuStack, MenuStackLen * sizeof(MUTTMENU *)); + } + + MenuStack[MenuStackCount++] = menu; +} + +void mutt_pop_current_menu (MUTTMENU *menu) +{ + if (!MenuStackCount || + (MenuStack[MenuStackCount - 1] != menu)) + { + mutt_debug (1, "mutt_pop_current_menu() called with inactive menu\n"); + return; + } + + MenuStackCount--; +} + + #define MUTT_SEARCH_UP 1 #define MUTT_SEARCH_DOWN 2 diff --git a/mutt_menu.h b/mutt_menu.h index 606183d75..2d8531883 100644 --- a/mutt_menu.h +++ b/mutt_menu.h @@ -119,6 +119,8 @@ void mutt_ts_icon(char *str); MUTTMENU *mutt_new_menu(int menu); void mutt_menu_destroy(MUTTMENU **p); +void mutt_push_current_menu (MUTTMENU *); +void mutt_pop_current_menu (MUTTMENU *); int mutt_menu_loop(MUTTMENU *menu); /* used in both the index and pager index to make an entry. */ diff --git a/mutt_ssl.c b/mutt_ssl.c index 3670b19a4..85627cc4e 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -765,6 +765,8 @@ static int interactive_check_cert (X509 *cert, int idx, int len, SSL *ssl, int a FILE *fp = NULL; int allow_skip = 0; + mutt_push_current_menu (menu); + menu->max = mutt_array_size (part) * 2 + 10; menu->dialog = safe_calloc (1, menu->max * sizeof (char *)); for (i = 0; i < menu->max; i++) @@ -897,6 +899,7 @@ static int interactive_check_cert (X509 *cert, int idx, int len, SSL *ssl, int a } } unset_option(OPTIGNOREMACROEVENTS); + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); set_option (OPTNEEDREDRAW); mutt_debug (2, "ssl interactive_check_cert: done=%d\n", done); diff --git a/mutt_ssl_gnutls.c b/mutt_ssl_gnutls.c index 2b31b499c..57e96233a 100644 --- a/mutt_ssl_gnutls.c +++ b/mutt_ssl_gnutls.c @@ -570,6 +570,7 @@ static int tls_check_one_certificate (const gnutls_datum_t *certdata, menu->dialog = safe_calloc (1, menu->max * sizeof (char *)); for (i = 0; i < menu->max; i++) menu->dialog[i] = safe_calloc (1, SHORT_STRING * sizeof (char)); + mutt_push_current_menu (menu); row = 0; strfcpy (menu->dialog[row], _("This certificate belongs to:"), SHORT_STRING); @@ -773,6 +774,7 @@ static int tls_check_one_certificate (const gnutls_datum_t *certdata, } } unset_option (OPTIGNOREMACROEVENTS); + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); gnutls_x509_crt_deinit (cert); diff --git a/pager.c b/pager.c index 9330d0ca3..b06bd9d31 100644 --- a/pager.c +++ b/pager.c @@ -1661,7 +1661,6 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) int i, j, ch = 0, rc = -1, hideQuoted = 0, q_level = 0, force_redraw = 0; int lines = 0, curline = 0, topline = 0, oldtopline = 0, err, first = 1; int r = -1, wrapped = 0, searchctx = 0; - int redraw = REDRAW_FULL; FILE *fp = NULL; LOFF_T last_pos = 0, last_offset = 0; int old_smart_wrap, old_markers; @@ -1675,6 +1674,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) mutt_window_t *pager_status_window = NULL; mutt_window_t *pager_window = NULL; + MUTTMENU *pager_menu = NULL; MUTTMENU *index = NULL; /* the Pager Index (PI) */ int indexlen = PagerIndexLines; /* indexlen not always == PIL */ int indicator = indexlen / 3; /* the indicator line of the PI */ @@ -1746,11 +1746,14 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) pager_status_window = safe_calloc (1, sizeof (mutt_window_t)); pager_window = safe_calloc (1, sizeof (mutt_window_t)); + pager_menu = mutt_new_menu (MENU_PAGER); + mutt_push_current_menu (pager_menu); + while (ch != -1) { mutt_curs_set (0); - if (redraw & REDRAW_FULL) + if (pager_menu->redraw & REDRAW_FULL) { #if ! (defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM)) mutt_reflow_windows (); @@ -1817,7 +1820,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) SearchBack = Resize->SearchBack; } lines = Resize->line; - redraw |= REDRAW_SIGWINCH; + pager_menu->redraw |= REDRAW_SIGWINCH; FREE (&Resize); } @@ -1852,14 +1855,14 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) menu_redraw_index(index); } - redraw |= REDRAW_BODY | REDRAW_INDEX | REDRAW_STATUS; + pager_menu->redraw |= REDRAW_BODY | REDRAW_INDEX | REDRAW_STATUS; #ifdef USE_SIDEBAR - redraw |= REDRAW_SIDEBAR; + pager_menu->redraw |= REDRAW_SIDEBAR; #endif mutt_show_error (); } - if (redraw & REDRAW_SIGWINCH) + if (pager_menu->redraw & REDRAW_SIGWINCH) { i = -1; j = -1; @@ -1875,14 +1878,14 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) } #ifdef USE_SIDEBAR - if ((redraw & REDRAW_SIDEBAR) || SidebarNeedsRedraw) + if ((pager_menu->redraw & REDRAW_SIDEBAR) || SidebarNeedsRedraw) { SidebarNeedsRedraw = 0; mutt_sb_draw (); } #endif - if ((redraw & REDRAW_BODY) || topline != oldtopline) + if ((pager_menu->redraw & REDRAW_BODY) || topline != oldtopline) { do { mutt_window_move (pager_window, 0, 0); @@ -1918,10 +1921,10 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) /* We are going to update the pager status bar, so it isn't * necessary to reset to normal color now. */ - redraw |= REDRAW_STATUS; /* need to update the % seen */ + pager_menu->redraw |= REDRAW_STATUS; /* need to update the % seen */ } - if (redraw & REDRAW_STATUS) + if (pager_menu->redraw & REDRAW_STATUS) { struct hdr_format_info hfi; char pager_progress_str[4]; @@ -1968,7 +1971,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) /* redraw the pager_index indicator, because the * flags for this message might have changed. */ - if ((redraw & REDRAW_INDEX) && index && (index_window->rows > 0)) + if ((pager_menu->redraw & REDRAW_INDEX) && index && (index_window->rows > 0)) { menu_redraw_current (index); @@ -1981,7 +1984,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) NORMAL_COLOR; } - redraw = 0; + pager_menu->redraw = 0; if (option(OPTBRAILLEFRIENDLY)) { if (brailleLine!=-1) { @@ -2024,7 +2027,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) { /* fatal error occurred */ FREE (&Context); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; ch = -1; break; } @@ -2071,7 +2074,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) } } - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; set_option (OPTSEARCHINVALID); } } @@ -2136,7 +2139,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) lastLine = 0; topline = 0; - redraw = REDRAW_FULL | REDRAW_SIGWINCH; + pager_menu->redraw = REDRAW_FULL | REDRAW_SIGWINCH; ch = 0; } @@ -2434,14 +2437,14 @@ search_next: } } - redraw = REDRAW_BODY; + pager_menu->redraw = REDRAW_BODY; break; case OP_SEARCH_TOGGLE: if (SearchCompiled) { SearchFlag ^= MUTT_SEARCH; - redraw = REDRAW_BODY; + pager_menu->redraw = REDRAW_BODY; } break; @@ -2451,7 +2454,7 @@ search_next: { InHelp = 1; mutt_help (MENU_PAGER); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; InHelp = 0; } else @@ -2465,7 +2468,7 @@ search_next: if (hideQuoted && lineInfo[topline].type == MT_COLOR_QUOTED) topline = up_n_lines (1, lineInfo, topline, hideQuoted); else - redraw = REDRAW_BODY; + pager_menu->redraw = REDRAW_BODY; } break; @@ -2537,7 +2540,7 @@ search_next: case OP_REDRAW: clearok (stdscr, true); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_NULL: @@ -2557,7 +2560,7 @@ search_next: extra->idx, extra->idxlen, extra->bdy); else - ci_bounce_message (extra->hdr, &redraw); + ci_bounce_message (extra->hdr, &pager_menu->redraw); break; case OP_RESEND: @@ -2569,12 +2572,12 @@ search_next: extra->bdy); else mutt_resend_message (NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_COMPOSE_TO_SENDER: mutt_compose_to_sender (extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_CHECK_TRADITIONAL: @@ -2594,7 +2597,7 @@ search_next: mutt_create_alias (extra->bdy->hdr->env, NULL); else mutt_create_alias (extra->hdr->env, NULL); - MAYBE_REDRAW (redraw); + MAYBE_REDRAW (pager_menu->redraw); break; case OP_PURGE_MESSAGE: @@ -2608,7 +2611,7 @@ search_next: mutt_set_flag (Context, extra->hdr, MUTT_PURGE, (ch == OP_PURGE_MESSAGE)); if (option (OPTDELETEUNTAG)) mutt_set_flag (Context, extra->hdr, MUTT_TAG, 0); - redraw = REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; @@ -2622,7 +2625,7 @@ search_next: CHECK_READONLY; if (mutt_change_flag (extra->hdr, (ch == OP_MAIN_SET_FLAG)) == 0) - redraw |= REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw |= REDRAW_STATUS | REDRAW_INDEX; if (extra->hdr->deleted && option (OPTRESOLVE)) { ch = -1; @@ -2659,9 +2662,9 @@ search_next: } if (!option (OPTRESOLVE) && PagerIndexLines) - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; else - redraw = REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw = REDRAW_STATUS | REDRAW_INDEX; } break; @@ -2754,7 +2757,7 @@ search_next: } if (option (OPTFORCEREDRAWPAGER)) - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; unset_option (OPTFORCEREDRAWINDEX); unset_option (OPTFORCEREDRAWPAGER); break; @@ -2766,7 +2769,7 @@ search_next: CHECK_ACL(MUTT_ACL_WRITE, "Cannot flag message"); mutt_set_flag (Context, extra->hdr, MUTT_FLAG, !extra->hdr->flagged); - redraw = REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; @@ -2780,7 +2783,7 @@ search_next: mutt_pipe_attachment_list (extra->fp, 0, extra->bdy, 0); else mutt_pipe_message (extra->hdr); - MAYBE_REDRAW (redraw); + MAYBE_REDRAW (pager_menu->redraw); break; case OP_PRINT: @@ -2795,7 +2798,7 @@ search_next: CHECK_MODE(IsHeader (extra) && !IsAttach (extra)); CHECK_ATTACH; ci_send_message (0, NULL, NULL, extra->ctx, NULL); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; #ifdef USE_NNTP @@ -2807,7 +2810,7 @@ search_next: query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES) break; ci_send_message (SENDNEWS, NULL, NULL, extra->ctx, NULL); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_FORWARD_TO_GROUP: @@ -2822,7 +2825,7 @@ search_next: extra->idxlen, extra->bdy, SENDNEWS); else ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_FOLLOWUP: @@ -2847,7 +2850,7 @@ search_next: else ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; } #endif @@ -2861,14 +2864,14 @@ search_next: SENDREPLY); else ci_send_message (SENDREPLY, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_RECALL_MESSAGE: CHECK_MODE(IsHeader (extra) && !IsAttach(extra)); CHECK_ATTACH; ci_send_message (SENDPOSTPONED, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_GROUP_REPLY: @@ -2879,7 +2882,7 @@ search_next: extra->idxlen, extra->bdy, SENDREPLY|SENDGROUPREPLY); else ci_send_message (SENDREPLY | SENDGROUPREPLY, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_LIST_REPLY: @@ -2890,7 +2893,7 @@ search_next: extra->idxlen, extra->bdy, SENDREPLY|SENDLISTREPLY); else ci_send_message (SENDREPLY | SENDLISTREPLY, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_FORWARD_MESSAGE: @@ -2901,7 +2904,7 @@ search_next: extra->idxlen, extra->bdy, 0); else ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_DECRYPT_SAVE: @@ -2934,7 +2937,7 @@ search_next: (ch == OP_DECODE_SAVE) || (ch == OP_DECODE_COPY), (ch == OP_DECRYPT_SAVE) || (ch == OP_DECRYPT_COPY) || 0, - &redraw) == 0 && (ch == OP_SAVE || ch == OP_DECODE_SAVE + &pager_menu->redraw) == 0 && (ch == OP_SAVE || ch == OP_DECODE_SAVE || ch == OP_DECRYPT_SAVE )) { @@ -2944,14 +2947,14 @@ search_next: rc = OP_MAIN_NEXT_UNDELETED; } else - redraw |= REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw |= REDRAW_STATUS | REDRAW_INDEX; } - MAYBE_REDRAW (redraw); + MAYBE_REDRAW (pager_menu->redraw); break; case OP_SHELL_ESCAPE: mutt_shell_escape (); - MAYBE_REDRAW (redraw); + MAYBE_REDRAW (pager_menu->redraw); break; case OP_TAG: @@ -2965,7 +2968,7 @@ search_next: ? NULL : Context->last_tag); } - redraw = REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; @@ -2985,7 +2988,7 @@ search_next: mutt_set_flag (Context, extra->hdr, MUTT_READ, 1); first = 0; Context->msgnotreadyet = -1; - redraw = REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; @@ -3001,7 +3004,7 @@ search_next: mutt_set_flag (Context, extra->hdr, MUTT_DELETE, 0); mutt_set_flag (Context, extra->hdr, MUTT_PURGE, 0); - redraw = REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; @@ -3031,9 +3034,9 @@ search_next: } if (!option (OPTRESOLVE) && PagerIndexLines) - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; else - redraw = REDRAW_STATUS | REDRAW_INDEX; + pager_menu->redraw = REDRAW_STATUS | REDRAW_INDEX; } break; @@ -3056,7 +3059,7 @@ search_next: mutt_view_attachments (extra->hdr); if (Context && extra->hdr->attach_del) Context->changed = 1; - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_MAIL_KEY: @@ -3068,7 +3071,7 @@ search_next: CHECK_MODE(IsHeader(extra)); CHECK_ATTACH; ci_send_message (SENDKEY, NULL, NULL, extra->ctx, extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_EDIT_LABEL: @@ -3076,7 +3079,7 @@ search_next: rc = mutt_label_message(extra->hdr); if (rc > 0) { Context->changed = 1; - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; mutt_message (_("%d labels changed."), rc); } else { @@ -3096,7 +3099,7 @@ search_next: } CHECK_MODE(IsHeader(extra)); crypt_extract_keys_from_messages(extra->hdr); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; case OP_WHAT_KEY: @@ -3116,7 +3119,7 @@ search_next: case OP_SIDEBAR_TOGGLE_VISIBLE: toggle_option (OPTSIDEBAR); mutt_reflow_windows(); - redraw = REDRAW_FULL; + pager_menu->redraw = REDRAW_FULL; break; #endif @@ -3158,6 +3161,8 @@ search_next: SearchCompiled = 0; } FREE (&lineInfo); + mutt_pop_current_menu (pager_menu); + mutt_menu_destroy (&pager_menu); if (index) mutt_menu_destroy(&index); diff --git a/pgpkey.c b/pgpkey.c index 00e4347e8..7747a59d7 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -520,6 +520,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, menu->make_entry = pgp_entry; menu->help = helpstr; menu->data = KeyTable; + mutt_push_current_menu (menu); if (p) snprintf (buf, sizeof (buf), _("PGP keys matching <%s>."), p->mailbox); @@ -639,6 +640,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, } } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); FREE (&KeyTable); diff --git a/postpone.c b/postpone.c index b6746001a..8e10c837b 100644 --- a/postpone.c +++ b/postpone.c @@ -174,6 +174,7 @@ static HEADER *select_msg (void) menu->title = _("Postponed Messages"); menu->data = PostContext; menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_POST, PostponeHelp); + mutt_push_current_menu (menu); /* The postponed mailbox is setup to have sorting disabled, but the global * Sort variable may indicate something different. Sorting has to be @@ -218,6 +219,7 @@ static HEADER *select_msg (void) } Sort = orig_sort; + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); return (r > -1 ? PostContext->hdrs[r] : NULL); } diff --git a/query.c b/query.c index 5c3a43d05..8b9d839b8 100644 --- a/query.c +++ b/query.c @@ -270,6 +270,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) menu->tag = query_tag; menu->title = title; menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_QUERY, QueryHelp); + mutt_push_current_menu (menu); if (results == NULL) { @@ -326,6 +327,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) menu->current = 0; + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); menu = mutt_new_menu (MENU_QUERY); menu->make_entry = query_entry; @@ -333,6 +335,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) menu->tag = query_tag; menu->title = title; menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_QUERY, QueryHelp); + mutt_push_current_menu (menu); /* count the number of results */ for (queryp = results; queryp; queryp = queryp->next) @@ -482,6 +485,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) set_option (OPTNEEDREDRAW); } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); } int mutt_query_complete (char *buf, size_t buflen) diff --git a/recvattach.c b/recvattach.c index 48c1a3d76..94ace2329 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1032,6 +1032,7 @@ void mutt_view_attachments (HEADER *hdr) menu->make_entry = attach_entry; menu->tag = mutt_tag_attach; menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_ATTACH, AttachHelp); + mutt_push_current_menu (menu); mutt_attach_init (cur); attach_collapse (cur, 0, 1, 0); @@ -1306,6 +1307,7 @@ void mutt_view_attachments (HEADER *hdr) mutt_free_body (&cur); } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); return; } diff --git a/remailer.c b/remailer.c index 68483a951..a56499af2 100644 --- a/remailer.c +++ b/remailer.c @@ -515,6 +515,7 @@ void mix_make_chain (LIST **chainp, int *redraw) menu->data = type2_list; menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MIX, RemailerHelp); menu->pagelen = MIX_VOFFSET - 1; + mutt_push_current_menu (menu); while (loop) { @@ -650,6 +651,7 @@ void mix_make_chain (LIST **chainp, int *redraw) } } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); /* construct the remailer list */ diff --git a/smime.c b/smime.c index 706b82a77..e7f031128 100644 --- a/smime.c +++ b/smime.c @@ -442,6 +442,7 @@ static smime_key_t *smime_select_key (smime_key_t *keys, char *query) menu->help = helpstr; menu->data = table; menu->title = title; + mutt_push_current_menu (menu); /* sorting keys might be done later - TODO */ mutt_clear_error(); @@ -488,6 +489,7 @@ static smime_key_t *smime_select_key (smime_key_t *keys, char *query) } } + mutt_pop_current_menu (menu); mutt_menu_destroy (&menu); FREE (&table); set_option (OPTNEEDREDRAW);