From: Kevin McCarthy Date: Wed, 5 Apr 2017 23:09:39 +0000 (-0700) Subject: Don't create query menu until after initial prompt. (see #3877) X-Git-Tag: neomutt-20170414^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eeb46777e83c0878cff9135353d76cb2b055042c;p=neomutt Don't create query menu until after initial prompt. (see #3877) A resize in the prompt will trigger a redraw, but the data won't be loaded yet, displaying a blank screen instead of the previous menu. Once the query is done, the data is loaded, but the menu->redraw state has been changed by the resize. We could manually flag a redraw, but it makes more sense visually logically to just create the menu after the query and results are loaded. --- diff --git a/query.c b/query.c index b1f7043ae..df141b1dd 100644 --- a/query.c +++ b/query.c @@ -318,16 +318,6 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) char helpstr[LONG_STRING]; char title[STRING]; - snprintf (title, sizeof (title), _("Query")); /* FIXME */ - - menu = mutt_new_menu (MENU_QUERY); - menu->make_entry = query_entry; - menu->search = query_search; - 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) { /* Prompt for Query */ @@ -341,6 +331,14 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) { snprintf (title, sizeof (title), _("Query '%s'"), buf); + menu = mutt_new_menu (MENU_QUERY); + menu->make_entry = query_entry; + menu->search = query_search; + 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) menu->max++; @@ -536,8 +534,8 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) free_query (&results); FREE (&QueryTable); - } - mutt_pop_current_menu (menu); - mutt_menuDestroy (&menu); + mutt_pop_current_menu (menu); + mutt_menuDestroy (&menu); + } }