]> granicus.if.org Git - neomutt/commitdiff
Don't create query menu until after initial prompt. (see #3877)
authorKevin McCarthy <kevin@8t8.us>
Wed, 5 Apr 2017 23:09:39 +0000 (16:09 -0700)
committerRichard Russon <rich@flatcap.org>
Sun, 9 Apr 2017 17:47:36 +0000 (18:47 +0100)
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.

query.c

diff --git a/query.c b/query.c
index 50d18ba7f5f0068a59a37bc48f2892a6d25ccf9a..d9f3f53d8fea2bcd75a79405c850ba08419e7add 100644 (file)
--- a/query.c
+++ b/query.c
@@ -262,16 +262,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 */
@@ -285,6 +275,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++;
@@ -480,10 +478,9 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf)
 
     free_query (&results);
     FREE (&QueryTable);
+    mutt_pop_current_menu (menu);
+    mutt_menu_destroy (&menu);
   }
-
-  mutt_pop_current_menu (menu);
-  mutt_menu_destroy (&menu);
 }
 int mutt_query_complete (char *buf, size_t buflen)
 {