]> 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)
committerKevin McCarthy <kevin@8t8.us>
Wed, 5 Apr 2017 23:09:39 +0000 (16:09 -0700)
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 b1f7043aed84859295c438dae69f246ab85e1600..df141b1dd1867ee8015ce79df038368831ff6418 100644 (file)
--- 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);
+  }
 }