changeset: 7067:fe5275246e13
user:      Kevin McCarthy <ke...@8t8.us>
date:      Tue May 30 12:47:01 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/fe5275246e13

automatic post-release commit for mutt-1.8.3

changeset: 7068:6a54fbc38fa4
user:      Kevin McCarthy <ke...@8t8.us>
date:      Tue May 30 12:47:18 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/6a54fbc38fa4

Added tag mutt-1-8-3-rel for changeset fe5275246e13

changeset: 7069:fff7d4bb459a
user:      Kevin McCarthy <ke...@8t8.us>
date:      Tue May 30 12:48:25 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/fff7d4bb459a

mutt-1.8.3 signed

changeset: 7070:35fba390b1f3
user:      Kevin McCarthy <ke...@8t8.us>
date:      Tue May 30 12:49:56 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/35fba390b1f3

merge stable

diffs (truncated from 7499 to 950 lines):

diff -r fa0c2155ab8f -r 35fba390b1f3 .hgsigs
--- a/.hgsigs   Tue May 23 15:53:30 2017 -0700
+++ b/.hgsigs   Tue May 30 12:49:56 2017 -0700
@@ -17,3 +17,4 @@
 d897983752f908dde07f84bada213f1b911ecf78 0 
iQIzBAABCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAliwgZsACgkQre92hIAxa9onjhAAkzBgcQK2XgYaplpcg58537BG0e1zZGOl7f/VEfzb3b+OXEsNH/iDoVPNAq9TM2iijkculupyrqfuPq2UFZlidvcwD0dPI96Tvt+b4zzBFHdopplXYN+NCquemwhDolXhXffS2Pl99hW1uoKldnRf7jFt3zMD3uYTXlf87i9Qd/wXz6f9tLuOBeVYoGwVbWB2myIjgh0BV7k75bxNU7a2qfJudpYc+x8gUP+z0knJh3oUK80AuxWJzOxDto2mBR5WxIqqpHoVNIrcVceQBpP4VGVGIVByo6mk/ukDWz5A05FMjkBQ+czeDMPy+hu5f+QO46Myu3aesF9HM4AJhddgBe+SuRMzv2vZ00Pk4KBlM6Sc3ECxraME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WRFp4bRPqoR/R7wIwcHW5xTeg8eUj87mqW+5aNdn4NP1c+RpWUi/UNNzhUq6qGQ7Dte8lHSTVIYUoISBTndrH5HF7pNtzDxouCmUys6Gf8ncrV91ndV1aHvjvP+QckqYqepyt/qKUsUMKA+cQtL6FQdiBvK3Z9H/lfEE+kn0YWMVb/wQMB6KCefPIEND653CDMNhQllU69/WW1F5LtKgpv2W8baGxCpG7Ig6J1Dkb+e5hevHYGAQVPXowUGxYvXQH5Gx7/WB8k4flSsJhQUduReLn/3Gj3KKtYbelskDCgOVXpVWigczdnSayaO3WDDL3TvxRzSiRsPoxFEc9RgEHek0MIIwFJwRF7+k+IBILeWUBXkEgP5eh9r32duLZbAQil0eDV/7a0jOnSpaa/O8VZB5DEY1ANIzFU+z+ndWJPFOBH2usFkeavo6u+cMxXS3Z080dlR4Z2ZFBPvuehTB8muQfS4sz4v6JEjrC28=
diff -r fa0c2155ab8f -r 35fba390b1f3 .hgtags
--- a/.hgtags   Tue May 23 15:53:30 2017 -0700
+++ b/.hgtags   Tue May 30 12:49:56 2017 -0700
@@ -109,3 +109,4 @@
 d897983752f908dde07f84bada213f1b911ecf78 mutt-1-8-rel
 f44974c10990ddbacf2670d82ea1448498f2fbfc mutt-1-8-1-rel
 c6ea4aed6bec9b1ad96376136a1ea56027bc79dd mutt-1-8-2-rel
+fe5275246e1393552c33ad76f2c888311db104c8 mutt-1-8-3-rel
diff -r fa0c2155ab8f -r 35fba390b1f3 ChangeLog
--- a/ChangeLog Tue May 23 15:53:30 2017 -0700
+++ b/ChangeLog Tue May 30 12:49:56 2017 -0700
@@ -1,3 +1,167 @@
+2017-05-23 15:53 -0700  Kevin McCarthy  <ke...@8t8.us>  (fa0c2155ab8f)
+
+       * mx.c: Fix memory leak when closing mailbox and using the sidebar.
+
+       The code updating the sidebar counts decremented the msgcount, but
+       did not set it back to the original value. Which means fastclose was
+       not freeing all the headers.
+
+       Update the sidebar only when something is deleted, since I don't
+       believe it's required otherwise and the code is a bit cleaner that
+       way.
+
+2017-05-22 18:18 -0700  Kevin McCarthy  <ke...@8t8.us>  (59a2125b49f2)
+
+       * imap/imap.c: Don't clean up idata when closing an open-append
+       mailbox.
+
+       open-append borrows the idata just for the connection. The "mailbox
+       specific" part of the idata may be being used by a normal open-
+       mailbox.
+
+       Don't free the idata "mailbox specific" part when closing an open-
+       append mailbox.
+
+       Thanks to Will Yardley for discovering the bug as part of testing
+       the revised IMAP fetch_headers code (in the default branch).
+
+2017-05-22 05:08 -0700  TAKAHASHI Tamotsu  <tta...@lapis.plala.or.jp>  
(1ddf2641f369)
+
+       * mx.c: Fix potential segv if mx_open_mailbox is passed an empty
+       string. (closes #3945)
+
+       If path is "", ctx->path will be NULL. realpath() generally will
+       segv if the first parameter is NULL.
+
+2017-05-12 09:15 -0700  Kevin McCarthy  <ke...@8t8.us>  (a97afb72d892)
+
+       * imap/imap.c: Turn IMAP_EXPUNGE_EXPECTED back off when syncing.
+       (closes #3940).
+
+       imap_sync_mailbox() turned on IMAP_EXPUNGE_EXPECTED when issuing a
+       EXPUNGE command during a sync. However, it forgot to turn it back
+       off.
+
+       That meant that an unexpected EXPUNGE that occurred during a
+       mx_check_mailbox -> imap_check_mailbox() -> imap_cmd_finish() call
+       was not setting idata->check_status = IMAP_EXPUNGE_PENDING; and so
+       imap_check_mailbox() was not returning MUTT_REOPENED.
+
+       This meant that although the Context had been changed, the index did
+       not run update_index(), resulting in a possible segfault.
+
+       Thanks to Uroš Juvan for reporting the issue, and his invaluable
+       description of how to reproduce the problem.
+
+2017-05-05 13:55 -0700  Kevin McCarthy  <ke...@8t8.us>  (71cb68efe98e)
+
+       * curs_main.c: Don't modify LastFolder/CurrentFolder upon aborting a
+       change folder operation.
+
+       Set LastFolder and CurrentFolder after mx_close_mailbox() has
+       successfully completed. Otherwise, if the close is aborted, they
+       will have incorrect values.
+
+2017-05-04 18:05 -0700  Kevin McCarthy  <ke...@8t8.us>  (c08c72a0e24c)
+
+       * mx.c: Fix sidebar count updates when closing mailbox. (closes #3938)
+
+       The context unread and flagged counts were being updated too early
+       in mx_close_mailbox(). Cancelling at any of the following prompts
+       would leave them in an incorrect state. Additionally, $move could
+       increase the delete count (for flagged messages), and $delete, if
+       answered no, could turn off message deletion.
+
+       Move all the sidebar buffy stat updating to the bottom of the
+       function, after all the prompts and processing.
+
+2017-04-30 15:20 -0700  Kevin McCarthy  <ke...@8t8.us>  (829584614fd6)
+
+       * headers.c: Refresh header color when updating label. (closes #3935)
+
+       color index with a '~y' pattern were not being updated after
+       adding/removing labels.
+
+2017-04-30 14:24 -0700  Kevin McCarthy  <ke...@8t8.us>  (c54ac874a32b)
+
+       * init.c, init.h: Fix unused function warnings when sidebar is
+       disabled. (closes #3936)
+
+       parse_path_list/unlist are currently only used by the
+       un/sidebar_whitelist commands. Add an ifdef around them to stop an
+       unused function warning. Add a comment too, so it's clear why they
+       are ifdef'ed.
+
+2017-04-30 13:32 -0700  Kevin McCarthy  <ke...@8t8.us>  (deb66bd24b9d)
+
+       * doc/manual.xml.head: Note that mbox-hooks are dependent on $move.
+
+       Add a note to the "Using Multiple Spool Mailboxes" section.
+
+2017-04-27 21:22 -0700  Kevin McCarthy  <ke...@8t8.us>  (b8952095b583)
+
+       * curs_lib.c, keymap.c, mutt_curses.h: Fix km_error_key() infinite
+       loop and unget buffer pollution.
+
+       'bind pager \Ch help' produces an infinite loop when an unbound key
+       is pressed in the pager. The reason is because km_error_key() tries
+       to verify that the key sequence is really bound to the OP_HELP
+       operation. It does this by using km_expand_key(),
+       tokenize_unget_string() on the resulting buffer, then checking if
+       the next km_dokey() returns OP_HELP.
+
+       The problem is that km_expand_key() does not always produce a string
+       that is properly reparsed by tokenize_unget_string(). Control-h
+       sequences are expanded to ^H. tokenize_unget_string() recognizes
+       this as two characters '^' and 'H'. km_error_key() checks the OP
+       returned, which is OP_PAGER_TOP for the '^'. This is not OP_HELP, so
+       it prints a generic error and returns. This leaves the 'H' in the
+       input buffer! Since 'H' (by default) is unbound in the pager, it
+       retriggers km_error_key(), resulting in an infinite loop.
+
+       The same issues can occur without control sequences: bind generic ?
+       noop bind generic dq help In the index, hitting an unbound key will
+       end up leaving 'q' in the unget buffer, because 'd' is bound in the
+       index menu and will be read by km_dokey().
+
+       A simple approach to fix this would be to just use the same code as
+       in mutt_make_help(), which has no double-check. This would be no
+       worse than the help menu, but can generate an inaccurate error
+       message (e.g if '?' were bound to noop)
+
+       This patch instead uses OP_END_COND as a barrier in the unget
+       buffer. It directly inserts the keys in the OP_HELP keymap, instead
+       of using km_expand_key() + tokenize_unget_string(). After calling
+       km_dokey() it flushes the unget buffer to the OP_END_COND barrier.
+
+       Thanks to Walter Alejandro Iglesias for reporting the bug.
+
+2017-04-26 15:40 -0700  Roger Cornelius  <r...@tenzing.org>  (9a0afe7815d1)
+
+       * mx.c: Fix error message when opening a mailbox with no read
+       permission. (closes #3934)
+
+       ctx->mx_ops ends up being NULL for both the case that ctx->magic is
+       0 and -1. This meant the mutt_perror() error message was never being
+       printed, because the check for ctx->mx_ops == NULL was taking place
+       first.
+
+       Move the "ctx->magic == -1" check first, so mutt will print out an
+       appropriate perror message in that case.
+
+2017-04-18 16:15 -0700  Kevin McCarthy  <ke...@8t8.us>  (2c57a7b4dc0b)
+
+       * .hgsigs: mutt-1.8.2 signed
+
+2017-04-18 16:14 -0700  Kevin McCarthy  <ke...@8t8.us>  (455a698f274b)
+
+       * .hgtags: Added tag mutt-1-8-2-rel for changeset c6ea4aed6bec
+
+2017-04-18 16:14 -0700  Kevin McCarthy  <ke...@8t8.us>  (c6ea4aed6bec)
+
+       * ChangeLog, UPDATING, VERSION: automatic post-release commit for
+       mutt-1.8.2
+
 2017-04-18 12:25 -0700  Kevin McCarthy  <ke...@8t8.us>  (33995363e723)
 
        * filter.c, init.c, pgp.c, protos.h: Fix GPG_TTY to be added to
diff -r fa0c2155ab8f -r 35fba390b1f3 UPDATING
--- a/UPDATING  Tue May 23 15:53:30 2017 -0700
+++ b/UPDATING  Tue May 30 12:49:56 2017 -0700
@@ -8,6 +8,10 @@
 The keys used are:
   !: modified feature, -: deleted feature, +: new feature
 
+1.8.3 (2017-05-30):
+
+  ! Bug fix release.
+
 1.8.2 (2017-04-18):
 
   ! Bug fix release.
diff -r fa0c2155ab8f -r 35fba390b1f3 VERSION
--- a/VERSION   Tue May 23 15:53:30 2017 -0700
+++ b/VERSION   Tue May 30 12:49:56 2017 -0700
@@ -1,1 +1,1 @@
-1.8.2
+1.8.3
diff -r fa0c2155ab8f -r 35fba390b1f3 addrbook.c
--- a/addrbook.c        Tue May 23 15:53:30 2017 -0700
+++ b/addrbook.c        Tue May 30 12:49:56 2017 -0700
@@ -145,15 +145,13 @@
     mutt_error _("You have no aliases!");
     return;
   }
-  
-  /* tell whoever called me to redraw the screen when I return */
-  set_option (OPTNEEDREDRAW);
-  
+
   menu = mutt_new_menu (MENU_ALIAS);
   menu->make_entry = alias_entry;
   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:
 
@@ -237,6 +235,7 @@
     rfc822_write_address (buf, buflen, AliasTable[t]->addr, 1);
   }
 
+  mutt_pop_current_menu (menu);
   mutt_menuDestroy (&menu);
   FREE (&AliasTable);
   
diff -r fa0c2155ab8f -r 35fba390b1f3 browser.c
--- a/browser.c Tue May 23 15:53:30 2017 -0700
+++ b/browser.c Tue May 30 12:49:56 2017 -0700
@@ -492,17 +492,20 @@
       tmp->msg_unread = Context->unread;
     }
 
+    strfcpy (buffer, NONULL (tmp->path), sizeof (buffer));
+    mutt_pretty_mailbox (buffer, sizeof (buffer));
+
 #ifdef USE_IMAP
     if (mx_is_imap (tmp->path))
     {
-      add_folder (menu, state, tmp->path, NULL, tmp);
+      add_folder (menu, state, buffer, NULL, tmp);
       continue;
     }
 #endif
 #ifdef USE_POP
     if (mx_is_pop (tmp->path))
     {
-      add_folder (menu, state, tmp->path, NULL, tmp);
+      add_folder (menu, state, buffer, NULL, tmp);
       continue;
     }
 #endif
@@ -528,9 +531,6 @@
        s.st_mtime = st2.st_mtime;
     }
 
-    strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
-    mutt_pretty_mailbox (buffer, sizeof (buffer));
-
     add_folder (menu, state, buffer, &s, tmp);
   }
   while ((tmp = tmp->next));
@@ -611,7 +611,7 @@
   char helpstr[LONG_STRING];
   char title[STRING];
   struct browser_state state;
-  MUTTMENU *menu;
+  MUTTMENU *menu = NULL;
   struct stat st;
   int i, killPrefix = 0;
   int multiple = (flags & MUTT_SEL_MULTI)  ? 1 : 0;
@@ -722,6 +722,7 @@
 
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER,
     FolderHelp);
+  mutt_push_current_menu (menu);
 
   init_menu (&state, menu, title, sizeof (title), buffy);
 
@@ -908,7 +909,6 @@
        }
 
        destroy_state (&state);
-       mutt_menuDestroy (&menu);
        goto bail;
 
       case OP_BROWSER_TELL:
@@ -954,7 +954,6 @@
          menu->current = 0; 
          menu->top = 0; 
          init_menu (&state, menu, title, sizeof (title), buffy);
-         MAYBE_REDRAW (menu->redraw);
        }
        /* else leave error on screen */
        break;
@@ -977,7 +976,6 @@
            menu->current = 0;
            menu->top = 0;
            init_menu (&state, menu, title, sizeof (title), buffy);
-           MAYBE_REDRAW (menu->redraw);
          }
        }
        break;
@@ -1015,7 +1013,6 @@
              state.entrylen--;
              mutt_message _("Mailbox deleted.");
              init_menu (&state, menu, title, sizeof (title), buffy);
-             MAYBE_REDRAW (menu->redraw);
            }
          }
          else
@@ -1080,7 +1077,6 @@
                  mutt_error _("Error scanning directory.");
                  if (examine_directory (menu, &state, LastDir, prefix) == -1)
                  {
-                   mutt_menuDestroy (&menu);
                    goto bail;
                  }
                }
@@ -1095,7 +1091,6 @@
              mutt_perror (buf);
          }
        }
-       MAYBE_REDRAW (menu->redraw);
        break;
        
       case OP_ENTER_MASK:
@@ -1151,7 +1146,6 @@
            else
            {
              mutt_error _("Error scanning directory.");
-             mutt_menuDestroy (&menu);
              goto bail;
            }
            killPrefix = 0;
@@ -1162,7 +1156,6 @@
            }
          }
        }
-       MAYBE_REDRAW (menu->redraw);
        break;
 
       case OP_SORT:
@@ -1246,10 +1239,8 @@
        {
          strfcpy (f, buf, flen);
          destroy_state (&state);
-         mutt_menuDestroy (&menu);
          goto bail;
        }
-       MAYBE_REDRAW (menu->redraw);
        break;
 
       case OP_BROWSER_VIEW_FILE:
@@ -1264,7 +1255,6 @@
        {
          strfcpy (f, state.entry[menu->current].name, flen);
          destroy_state (&state);
-         mutt_menuDestroy (&menu);
          goto bail;
        }
        else
@@ -1296,7 +1286,13 @@
   }
   
   bail:
-  
+
+  if (menu)
+  {
+    mutt_pop_current_menu (menu);
+    mutt_menuDestroy (&menu);
+  }
+
   if (!folder)
     strfcpy (LastDir, LastDirBackup, sizeof (LastDir));
   
diff -r fa0c2155ab8f -r 35fba390b1f3 buffy.c
--- a/buffy.c   Tue May 23 15:53:30 2017 -0700
+++ b/buffy.c   Tue May 30 12:49:56 2017 -0700
@@ -27,6 +27,7 @@
 #include "mx.h"
 
 #include "mutt_curses.h"
+#include "mutt_menu.h"
 
 #ifdef USE_SIDEBAR
 #include "sidebar.h"
@@ -580,7 +581,7 @@
         (orig_count != tmp->msg_count) ||
         (orig_unread != tmp->msg_unread) ||
         (orig_flagged != tmp->msg_flagged))
-      SidebarNeedsRedraw = 1;
+      mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 #endif
 
     if (!tmp->new)
diff -r fa0c2155ab8f -r 35fba390b1f3 color.c
--- a/color.c   Tue May 23 15:53:30 2017 -0700
+++ b/color.c   Tue May 30 12:49:56 2017 -0700
@@ -22,6 +22,7 @@
 
 #include "mutt.h"
 #include "mutt_curses.h"
+#include "mutt_menu.h"
 #include "mapping.h"
 
 #include <string.h>
@@ -105,6 +106,16 @@
   { NULL,              0 }
 };
 
+static const struct mapping_t ComposeFields[] =
+{
+  { "header",               MT_COLOR_COMPOSE_HEADER },
+  { "security_encrypt",     MT_COLOR_COMPOSE_SECURITY_ENCRYPT },
+  { "security_sign",        MT_COLOR_COMPOSE_SECURITY_SIGN },
+  { "security_both",        MT_COLOR_COMPOSE_SECURITY_BOTH },
+  { "security_none",        MT_COLOR_COMPOSE_SECURITY_NONE },
+  { NULL,                   0 }
+};
+
 #define COLOR_QUOTE_INIT       8
 
 static COLOR_LINE *mutt_new_color_line (void)
@@ -494,7 +505,7 @@
   if (do_cache && !option (OPTNOCURSES))
   {
     int i;
-    set_option (OPTFORCEREDRAWINDEX);
+    mutt_set_menu_redraw_full (MENU_MAIN);
     /* force re-caching of index colors */
     for (i = 0; Context && i < Context->msgcount; i++)
       Context->hdrs[i]->pair = 0;
@@ -621,6 +632,22 @@
     
     *o = MT_COLOR_QUOTED;
   }
+  else if (!ascii_strcasecmp(buf->data, "compose"))
+  {
+    if (!MoreArgs(s))
+    {
+      strfcpy(err->data, _("Missing arguments."), err->dsize);
+      return -1;
+    }
+
+    mutt_extract_token(buf, s, 0);
+
+    if ((*o = mutt_getvaluebyname (buf->data, ComposeFields)) == -1)
+    {
+      snprintf (err->data, err->dsize, _("%s: no such object"), buf->data);
+      return (-1);
+    }
+  }
   else if ((*o = mutt_getvaluebyname (buf->data, Fields)) == -1)
   {
     snprintf (err->data, err->dsize, _("%s: no such object"), buf->data);
@@ -771,7 +798,7 @@
   else if (object == MT_COLOR_INDEX)
   {
     r = add_pattern (&ColorIndexList, buf->data, 1, fg, bg, attr, err, 1);
-    set_option (OPTFORCEREDRAWINDEX);
+    mutt_set_menu_redraw_full (MENU_MAIN);
   }
   else if (object == MT_COLOR_QUOTED)
   {
diff -r fa0c2155ab8f -r 35fba390b1f3 commands.c
--- a/commands.c        Tue May 23 15:53:30 2017 -0700
+++ b/commands.c        Tue May 30 12:49:56 2017 -0700
@@ -238,7 +238,7 @@
   return rc;
 }
 
-void ci_bounce_message (HEADER *h, int *redraw)
+void ci_bounce_message (HEADER *h)
 {
   char prompt[SHORT_STRING];
   char scratch[SHORT_STRING];
@@ -276,13 +276,6 @@
     strfcpy(prompt, _("Bounce tagged messages to: "), sizeof(prompt));
   
   rc = mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS);
-
-  if (option (OPTNEEDREDRAW))
-  {
-    unset_option (OPTNEEDREDRAW);
-    *redraw = REDRAW_FULL;
-  }
-
   if (rc || !buf[0])
     return;
 
@@ -413,10 +406,12 @@
       mutt_perror _("Can't create filter process");
       return 1;
     }
-      
+
+    set_option (OPTKEEPQUIET);
     pipe_msg (h, fpout, decode, print);
     safe_fclose (&fpout);
     rc = mutt_wait_filter (thepid);
+    unset_option (OPTKEEPQUIET);
   }
   else
   { /* handle tagged messages */
@@ -447,12 +442,14 @@
            mutt_perror _("Can't create filter process");
            return 1;
          }
+          set_option (OPTKEEPQUIET);
           pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
           /* add the message separator */
           if (sep)  fputs (sep, fpout);
          safe_fclose (&fpout);
          if (mutt_wait_filter (thepid) != 0)
            rc = 1;
+          unset_option (OPTKEEPQUIET);
         }
       }
     }
@@ -464,6 +461,7 @@
        mutt_perror _("Can't create filter process");
        return 1;
       }
+      set_option (OPTKEEPQUIET);
       for (i = 0; i < Context->vcount; i++)
       {
         if (Context->hdrs[Context->v2r[i]]->tagged)
@@ -477,6 +475,7 @@
       safe_fclose (&fpout);
       if (mutt_wait_filter (thepid) != 0)
        rc = 1;
+      unset_option (OPTKEEPQUIET);
     }
   }
 
@@ -534,12 +533,13 @@
 
   switch (mutt_multi_choice (reverse ?
        /* L10N: The following three are the sort/reverse sort prompts.
-        * Capital letters must match the order of the characters in the third
-        * string.
+        * Letters must match the order of the characters in the third
+        * string.  Note that mutt now supports multiline prompts, so
+        * it's okay for the translation to take up to three lines.
         */
-                            _("Rev-Sort 
Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: ") :
-                            _("Sort 
Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: "),
-                            _("dfrsotuzcpl")))
+       _("Rev-Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: 
") :
+       _("Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: "),
+       _("dfrsotuzcpl")))
   {
   case -1: /* abort - don't resort */
     return -1;
@@ -734,8 +734,7 @@
 }
 
 /* returns 0 if the copy/save was successful, or -1 on error/abort */
-int mutt_save_message (HEADER *h, int delete, 
-                      int decode, int decrypt, int *redraw)
+int mutt_save_message (HEADER *h, int delete, int decode, int decrypt)
 {
   int i, need_buffy_cleanup;
   int need_passphrase = 0, app=0;
@@ -743,9 +742,6 @@
   CONTEXT ctx;
   struct stat st;
 
-  *redraw = 0;
-
-  
   snprintf (prompt, sizeof (prompt),
            decode  ? (delete ? _("Decode-save%s to mailbox") :
                       _("Decode-copy%s to mailbox")) :
@@ -793,17 +789,9 @@
   }
 
   mutt_pretty_mailbox (buf, sizeof (buf));
-  if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1)
+  if (mutt_enter_fname (prompt, buf, sizeof (buf), 0) == -1)
     return (-1);
 
-  if (*redraw != REDRAW_FULL)
-  {
-    if (!h)
-      *redraw = REDRAW_INDEX | REDRAW_STATUS;
-    else
-      *redraw = REDRAW_STATUS;
-  }
-
   if (!buf[0])
     return (-1);
  
diff -r fa0c2155ab8f -r 35fba390b1f3 compose.c
--- a/compose.c Tue May 23 15:53:30 2017 -0700
+++ b/compose.c Tue May 30 12:49:56 2017 -0700
@@ -110,7 +110,9 @@
 
 static void redraw_crypt_lines (HEADER *msg)
 {
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPT, 0, TITLE_FMT, "Security: 
");
+  NORMAL_COLOR;
 
   if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
   {
@@ -119,13 +121,26 @@
   }
 
   if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN))
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_BOTH);
     addstr (_("Sign, Encrypt"));
+  }
   else if (msg->security & ENCRYPT)
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_ENCRYPT);
     addstr (_("Encrypt"));
+  }
   else if (msg->security & SIGN)
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_SIGN);
     addstr (_("Sign"));
+  }
   else
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_SECURITY_NONE);
     addstr (_("None"));
+  }
+  NORMAL_COLOR;
 
   if ((msg->security & (ENCRYPT | SIGN)))
   {
@@ -150,20 +165,32 @@
 
   if ((WithCrypto & APPLICATION_PGP)
       && (msg->security & APPLICATION_PGP) && (msg->security & SIGN))
-    printw (TITLE_FMT "%s", _("sign as: "), PgpSignAs ? PgpSignAs : 
_("<default>"));
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_HEADER);
+    printw (TITLE_FMT, _("sign as: "));
+    NORMAL_COLOR;
+    printw ("%s", PgpSignAs ? PgpSignAs : _("<default>"));
+  }
 
   if ((WithCrypto & APPLICATION_SMIME)
-      && (msg->security & APPLICATION_SMIME) && (msg->security & SIGN)) {
-      printw (TITLE_FMT "%s", _("sign as: "), SmimeDefaultKey ? 
SmimeDefaultKey : _("<default>"));
+      && (msg->security & APPLICATION_SMIME) && (msg->security & SIGN))
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_HEADER);
+    printw (TITLE_FMT, _("sign as: "));
+    NORMAL_COLOR;
+    printw ("%s", SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
   }
 
   if ((WithCrypto & APPLICATION_SMIME)
       && (msg->security & APPLICATION_SMIME)
       && (msg->security & ENCRYPT)
       && SmimeCryptAlg
-      && *SmimeCryptAlg) {
-    mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPTINFO, 40, "%s%s", 
_("Encrypt with: "),
-               NONULL(SmimeCryptAlg));
+      && *SmimeCryptAlg)
+  {
+    SETCOLOR (MT_COLOR_COMPOSE_HEADER);
+    mutt_window_mvprintw (MuttIndexWindow, HDR_CRYPTINFO, 40, "%s", _("Encrypt 
with: "));
+    NORMAL_COLOR;
+    printw ("%s", NONULL(SmimeCryptAlg));
   }
 }
 
@@ -175,8 +202,10 @@
   int c;
   char *t;
 
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   /* L10N: "Mix" refers to the MixMaster chain for anonymous email */
   mutt_window_mvprintw (MuttIndexWindow, HDR_MIX, 0, TITLE_FMT, _("Mix: "));
+  NORMAL_COLOR;
 
   if (!chain)
   {
@@ -243,7 +272,9 @@
 
   buf[0] = 0;
   rfc822_write_address (buf, sizeof (buf), addr, 1);
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, line, 0, TITLE_FMT, Prompts[line]);
+  NORMAL_COLOR;
   mutt_paddstr (W, buf);
 }
 
@@ -253,10 +284,17 @@
   draw_envelope_addr (HDR_TO, msg->env->to);
   draw_envelope_addr (HDR_CC, msg->env->cc);
   draw_envelope_addr (HDR_BCC, msg->env->bcc);
+
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, HDR_SUBJECT, 0, TITLE_FMT, 
Prompts[HDR_SUBJECT]);
+  NORMAL_COLOR;
   mutt_paddstr (W, NONULL (msg->env->subject));
+
   draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
+
+  SETCOLOR (MT_COLOR_COMPOSE_HEADER);
   mutt_window_mvprintw (MuttIndexWindow, HDR_FCC, 0, TITLE_FMT, 
Prompts[HDR_FCC]);
+  NORMAL_COLOR;
   mutt_paddstr (W, fcc);
 
   if (WithCrypto)
@@ -273,7 +311,7 @@
   NORMAL_COLOR;
 }
 
-static int edit_address_list (int line, ADDRESS **addr)
+static void edit_address_list (int line, ADDRESS **addr)
 {
   char buf[HUGE_STRING] = ""; /* needs to be large for alias expansion */
   char *err = NULL;
@@ -287,12 +325,6 @@
     *addr = mutt_expand_aliases (*addr);
   }
 
-  if (option (OPTNEEDREDRAW))
-  {
-    unset_option (OPTNEEDREDRAW);
-    return (REDRAW_FULL);
-  }
-
   if (mutt_addrlist_to_intl (*addr, &err) != 0)
   {
     mutt_error (_("Warning: '%s' is a bad IDN."), err);
@@ -305,8 +337,6 @@
   rfc822_write_address (buf, sizeof (buf), *addr, 1);
   mutt_window_move (MuttIndexWindow, line, HDR_XOFFSET);
   mutt_paddstr (W, buf);
-  
-  return 0;
 }
 
 static int delete_attachment (MUTTMENU *menu, short *idxlen, int x)
@@ -476,6 +506,54 @@
         (unsigned long) menu, 0);
 }
 
+typedef struct
+{
+  HEADER *msg;
+  char *fcc;
+} compose_redraw_data_t;
+
+static void compose_menu_redraw (MUTTMENU *menu)
+{
+  char buf[LONG_STRING];
+  compose_redraw_data_t *rd = menu->redraw_data;
+
+  if (!rd)
+    return;
+
+  if (menu->redraw & REDRAW_FULL)
+  {
+    menu_redraw_full (menu);
+
+    draw_envelope (rd->msg, rd->fcc);
+    menu->offset = HDR_ATTACH;
+    menu->pagelen = MuttIndexWindow->rows - HDR_ATTACH;
+  }
+
+  menu_check_recenter (menu);
+
+  if (menu->redraw & REDRAW_STATUS)
+  {
+    compose_status_line (buf, sizeof (buf), 0, MuttStatusWindow->cols, menu, 
NONULL(ComposeFormat));
+    mutt_window_move (MuttStatusWindow, 0, 0);
+    SETCOLOR (MT_COLOR_STATUS);
+    mutt_paddstr (MuttStatusWindow->cols, buf);
+    NORMAL_COLOR;
+    menu->redraw &= ~REDRAW_STATUS;
+  }
+
+#ifdef USE_SIDEBAR
+  if (menu->redraw & REDRAW_SIDEBAR)
+    menu_redraw_sidebar (menu);
+#endif
+
+  if (menu->redraw & REDRAW_INDEX)
+    menu_redraw_index (menu);
+  else if (menu->redraw & (REDRAW_MOTION | REDRAW_MOTION_RESYNCH))
+    menu_redraw_motion (menu);
+  else if (menu->redraw == REDRAW_CURRENT)
+    menu_redraw_current (menu);
+}
+
 
 /* return values:
  *
@@ -505,6 +583,10 @@
   /* Sort, SortAux could be changed in mutt_index_menu() */
   int oldSort, oldSortAux;
   struct stat st;
+  compose_redraw_data_t rd;
+
+  rd.msg = msg;
+  rd.fcc = fcc;
 
   mutt_attach_init (msg->content);
   idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1);
@@ -516,22 +598,20 @@
   menu->tag = mutt_tag_attach;
   menu->data = idx;
   menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, 
ComposeHelp);
+  menu->custom_menu_redraw = compose_menu_redraw;
+  menu->redraw_data = &rd;
+  mutt_push_current_menu (menu);
 
   while (loop)
   {
     switch (op = mutt_menuLoop (menu))
     {
-      case OP_REDRAW:
-       draw_envelope (msg, fcc);
-       menu->offset = HDR_ATTACH;
-       menu->pagelen = MuttIndexWindow->rows - HDR_ATTACH;
-       break;
       case OP_COMPOSE_EDIT_FROM:
-       menu->redraw = edit_address_list (HDR_FROM, &msg->env->from);
+       edit_address_list (HDR_FROM, &msg->env->from);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
        break;
       case OP_COMPOSE_EDIT_TO:
-       menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
+       edit_address_list (HDR_TO, &msg->env->to);
        if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
        {
          crypt_opportunistic_encrypt (msg);
@@ -540,7 +620,7 @@
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
       case OP_COMPOSE_EDIT_BCC:
-       menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
+       edit_address_list (HDR_BCC, &msg->env->bcc);
        if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
        {
          crypt_opportunistic_encrypt (msg);
@@ -549,7 +629,7 @@
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
        break;
       case OP_COMPOSE_EDIT_CC:
-       menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
+       edit_address_list (HDR_CC, &msg->env->cc);
        if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
        {
          crypt_opportunistic_encrypt (msg);
@@ -574,7 +654,7 @@
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
       case OP_COMPOSE_EDIT_REPLY_TO:
-       menu->redraw = edit_address_list (HDR_REPLYTO, &msg->env->reply_to);
+       edit_address_list (HDR_REPLYTO, &msg->env->reply_to);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
        break;
       case OP_COMPOSE_EDIT_FCC:
@@ -587,7 +667,6 @@
          mutt_paddstr (W, fcc);
          fccSet = 1;
        }
-       MAYBE_REDRAW (menu->redraw);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
       case OP_COMPOSE_EDIT_MESSAGE:
@@ -666,12 +745,6 @@
          FREE (&idx[idxlen]);
 
        menu->redraw |= REDRAW_STATUS;
-
-       if (option(OPTNEEDREDRAW))
-       {
-         menu->redraw = REDRAW_FULL;
-         unset_option(OPTNEEDREDRAW);
-       }
        
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
@@ -687,7 +760,7 @@
          numfiles = 0;
          files = NULL;
 
-         if (_mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 
0, 1, &files, &numfiles) == -1 ||
+         if (_mutt_enter_fname (prompt, fname, sizeof (fname), 0, 1, &files, 
&numfiles) == -1 ||
              *fname == '\0')
            break;
 
@@ -739,7 +812,7 @@
            mutt_pretty_mailbox (fname, sizeof (fname));
          }
 
-         if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 
1) == -1 || !fname[0])
+         if (mutt_enter_fname (prompt, fname, sizeof (fname), 1) == -1 || 
!fname[0])
            break;
 
          mutt_expand_path (fname, sizeof (fname));
@@ -1164,7 +1237,6 @@
       case OP_SAVE:
        CHECK_COUNT;
        mutt_save_attachment_list (NULL, menu->tagprefix, menu->tagprefix ?  
msg->content : idx[menu->current]->content, NULL, menu);
-       MAYBE_REDRAW (menu->redraw);
         /* no send2hook, since this doesn't modify the message */
        break;
 
@@ -1250,7 +1322,7 @@
        if (idxlen)
          msg->content = idx[0]->content;
        if (mutt_enter_fname (_("Write message to mailbox"), fname, sizeof 
(fname),
-                             &menu->redraw, 1) != -1 && fname[0])
+                             1) != -1 && fname[0])
        {
          mutt_message (_("Writing message to %s ..."), fname);
          mutt_expand_path (fname, sizeof (fname));
@@ -1288,7 +1360,7 @@
           crypt_opportunistic_encrypt (msg);
           redraw_crypt_lines (msg);
        }
-       msg->security = crypt_pgp_send_menu (msg, &menu->redraw);
+       msg->security = crypt_pgp_send_menu (msg);
        redraw_crypt_lines (msg);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
@@ -1321,7 +1393,7 @@
           crypt_opportunistic_encrypt (msg);
           redraw_crypt_lines (msg);
        }
-       msg->security = crypt_smime_send_menu(msg, &menu->redraw);
+       msg->security = crypt_smime_send_menu(msg);
        redraw_crypt_lines (msg);
         mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
         break;
@@ -1330,25 +1402,15 @@

Reply via email to