changeset: 6986:06553f524887
user:      Kevin McCarthy <ke...@8t8.us>
date:      Fri Mar 31 18:15:12 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/06553f524887

Remove the OPTFORCEREDRAW options.

Use the menu stack to flag redraws for the index and pager.

changeset: 6987:b36e4918d1d9
user:      Kevin McCarthy <ke...@8t8.us>
date:      Fri Mar 31 18:15:20 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/b36e4918d1d9

Remove SidebarNeedsRedraw.

The menu stack can be used to flag a redraw of the sidebar window.

changeset: 6988:7f47e330bd72
user:      Kevin McCarthy <ke...@8t8.us>
date:      Fri Mar 31 18:15:22 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/7f47e330bd72

Change reflow_windows() to set full redraw.

A full redraw should always be set in this case.  This also enables us
to remove redraw flags for some options.

changeset: 6989:68bbc47c8498
user:      Kevin McCarthy <ke...@8t8.us>
date:      Fri Mar 31 18:15:28 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/68bbc47c8498

Create R_MENU redraw option.

Previously, the R_INDEX option meant both the index as well as all
other menus.  The removal of the OPTFORCEREDRAWINDEX option caused problems
with redrawing other menus for options such as arrow_cursor.

One solution would be change R_INDEX back to meaning "everything"
except pager, but there are only a handful of options that affect
other menus.

Instead, create R_MENU to indicate options that affect either all
menus or one of the other menus beside the index and pager.

changeset: 6990:8b9bbd983b1a
user:      Kevin McCarthy <ke...@8t8.us>
date:      Fri Mar 31 18:15:31 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/8b9bbd983b1a

Remove refresh parameter from mutt_enter_fname().

Also remove it from mutt_save_message(), which used it to pass through
to mutt_enter_fname().  The callers of this already had redraw logic,
to which REDRAW_STATUS merely needed to be added.

diffs (684 lines):

diff -r 6fb6021389c8 -r 8b9bbd983b1a buffy.c
--- a/buffy.c   Fri Mar 31 17:29:35 2017 +0200
+++ b/buffy.c   Fri Mar 31 18:15:31 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 6fb6021389c8 -r 8b9bbd983b1a color.c
--- a/color.c   Fri Mar 31 17:29:35 2017 +0200
+++ b/color.c   Fri Mar 31 18:15:31 2017 -0700
@@ -22,6 +22,7 @@
 
 #include "mutt.h"
 #include "mutt_curses.h"
+#include "mutt_menu.h"
 #include "mapping.h"
 
 #include <string.h>
@@ -494,7 +495,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;
@@ -771,7 +772,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 6fb6021389c8 -r 8b9bbd983b1a commands.c
--- a/commands.c        Fri Mar 31 17:29:35 2017 +0200
+++ b/commands.c        Fri Mar 31 18:15:31 2017 -0700
@@ -727,8 +727,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;
@@ -736,9 +735,6 @@
   CONTEXT ctx;
   struct stat st;
 
-  *redraw = 0;
-
-  
   snprintf (prompt, sizeof (prompt),
            decode  ? (delete ? _("Decode-save%s to mailbox") :
                       _("Decode-copy%s to mailbox")) :
@@ -786,17 +782,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 6fb6021389c8 -r 8b9bbd983b1a compose.c
--- a/compose.c Fri Mar 31 17:29:35 2017 +0200
+++ b/compose.c Fri Mar 31 18:15:31 2017 -0700
@@ -673,7 +673,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;
 
@@ -724,7 +724,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));
@@ -1234,7 +1234,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));
diff -r 6fb6021389c8 -r 8b9bbd983b1a curs_lib.c
--- a/curs_lib.c        Fri Mar 31 17:29:35 2017 +0200
+++ b/curs_lib.c        Fri Mar 31 18:15:31 2017 -0700
@@ -94,7 +94,7 @@
 {
   keypad (stdscr, TRUE);
   clearok (stdscr, TRUE);
-  mutt_set_current_menu_redraw ();
+  mutt_set_current_menu_redraw_full ();
 }
 
 event_t mutt_getch (void)
@@ -548,6 +548,8 @@
     MuttIndexWindow->col_offset += SidebarWidth;
   }
 #endif
+
+  mutt_set_current_menu_redraw_full ();
 }
 
 int mutt_window_move (mutt_window_t *win, int row, int col)
@@ -733,7 +735,7 @@
   return rc;
 }
 
-int _mutt_enter_fname (const char *prompt, char *buf, size_t blen, int 
*redraw, int buffy, int multiple, char ***files, int *numfiles)
+int _mutt_enter_fname (const char *prompt, char *buf, size_t blen, int buffy, 
int multiple, char ***files, int *numfiles)
 {
   event_t ch;
 
@@ -758,7 +760,6 @@
     buf[0] = 0;
     _mutt_select_file (buf, blen, MUTT_SEL_FOLDER | (multiple ? MUTT_SEL_MULTI 
: 0), 
                       files, numfiles);
-    *redraw = REDRAW_FULL;
   }
   else
   {
diff -r 6fb6021389c8 -r 8b9bbd983b1a curs_main.c
--- a/curs_main.c       Fri Mar 31 17:29:35 2017 +0200
+++ b/curs_main.c       Fri Mar 31 18:15:31 2017 -0700
@@ -622,7 +622,7 @@
       }
 
 #ifdef USE_SIDEBAR
-      if (menu->redraw & REDRAW_SIDEBAR || SidebarNeedsRedraw)
+      if (menu->redraw & REDRAW_SIDEBAR)
       {
         mutt_sb_set_buffystats (Context);
         menu_redraw_sidebar (menu);
@@ -1216,7 +1216,7 @@
        {
          mutt_buffy (buf, sizeof (buf));
 
-          if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
+          if (mutt_enter_fname (cp, buf, sizeof (buf), 1) == -1)
           {
             if (menu->menu == MENU_PAGER)
             {
@@ -1561,11 +1561,11 @@
                               (op == OP_SAVE) || (op == OP_DECODE_SAVE),
                               (op == OP_DECODE_SAVE) || (op == OP_DECODE_COPY),
                               (op == OP_DECRYPT_SAVE) || (op == 
OP_DECRYPT_COPY) ||
-                              0,
-                              &menu->redraw) == 0 &&
+                              0) == 0 &&
             (op == OP_SAVE || op == OP_DECODE_SAVE || op == OP_DECRYPT_SAVE)
            )
        {
+          menu->redraw |= REDRAW_STATUS;
          if (tag)
            menu->redraw |= REDRAW_INDEX;
          else if (option (OPTRESOLVE))
@@ -2053,10 +2053,6 @@
 
        mutt_enter_command ();
        mutt_check_rescore (Context);
-       if (option (OPTFORCEREDRAWINDEX))
-         menu->redraw = REDRAW_FULL;
-       unset_option (OPTFORCEREDRAWINDEX);
-       unset_option (OPTFORCEREDRAWPAGER);
        break;
 
       case OP_EDIT_MESSAGE:
@@ -2440,7 +2436,6 @@
       case OP_SIDEBAR_TOGGLE_VISIBLE:
        toggle_option (OPTSIDEBAR);
         mutt_reflow_windows();
-       menu->redraw = REDRAW_FULL;
        break;
 #endif
       default:
diff -r 6fb6021389c8 -r 8b9bbd983b1a flags.c
--- a/flags.c   Fri Mar 31 17:29:35 2017 +0200
+++ b/flags.c   Fri Mar 31 18:15:31 2017 -0700
@@ -22,6 +22,7 @@
 
 #include "mutt.h"
 #include "mutt_curses.h"
+#include "mutt_menu.h"
 #include "sort.h"
 #include "mx.h"
 
@@ -273,7 +274,7 @@
   {
     mutt_set_header_color(ctx, h);
 #ifdef USE_SIDEBAR
-    SidebarNeedsRedraw = 1;
+    mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 #endif
   }
 
diff -r 6fb6021389c8 -r 8b9bbd983b1a globals.h
--- a/globals.h Fri Mar 31 17:29:35 2017 +0200
+++ b/globals.h Fri Mar 31 18:15:31 2017 -0700
@@ -226,7 +226,6 @@
 #ifdef USE_SIDEBAR
 WHERE short SidebarWidth;
 WHERE LIST *SidebarWhitelist INITVAL(0);
-WHERE int SidebarNeedsRedraw INITVAL (0);
 #endif
 
 #ifdef USE_IMAP
diff -r 6fb6021389c8 -r 8b9bbd983b1a imap/command.c
--- a/imap/command.c    Fri Mar 31 17:29:35 2017 +0200
+++ b/imap/command.c    Fri Mar 31 18:15:31 2017 -0700
@@ -26,6 +26,7 @@
 #endif
 
 #include "mutt.h"
+#include "mutt_menu.h"
 #include "imap_private.h"
 #include "mx.h"
 #include "buffy.h"
@@ -1004,7 +1005,7 @@
         if ((inc->new != new) ||
             (inc->msg_count != status->messages) ||
             (inc->msg_unread != status->unseen))
-          SidebarNeedsRedraw = 1;
+          mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 #endif
         inc->new = new;
         if (new_msg_count)
diff -r 6fb6021389c8 -r 8b9bbd983b1a init.c
--- a/init.c    Fri Mar 31 17:29:35 2017 +0200
+++ b/init.c    Fri Mar 31 18:15:31 2017 -0700
@@ -1291,8 +1291,8 @@
     print_attach_list(AttachExclude, '-', "A");
     print_attach_list(InlineAllow,   '+', "I");
     print_attach_list(InlineExclude, '-', "I");
-    set_option (OPTFORCEREDRAWINDEX);
-    set_option (OPTFORCEREDRAWPAGER);
+    mutt_set_menu_redraw_full (MENU_MAIN);
+    mutt_set_menu_redraw_full (MENU_PAGER);
     mutt_any_key_to_continue (NULL);
     return 0;
   }
@@ -1436,7 +1436,7 @@
       {
        for (tmp = Aliases; tmp ; tmp = tmp->next) 
          tmp->del = 1;
-       set_option (OPTFORCEREDRAWINDEX);
+       mutt_set_current_menu_redraw_full ();
       }
       else
        mutt_free_alias (&Aliases);
@@ -1450,7 +1450,7 @@
          if (CurrentMenu == MENU_ALIAS)
          {
            tmp->del = 1;
-           set_option (OPTFORCEREDRAWINDEX);
+           mutt_set_current_menu_redraw_full ();
            break;
          }
 
@@ -1511,7 +1511,7 @@
     /* override the previous value */
     rfc822_free_address (&tmp->addr);
     if (CurrentMenu == MENU_ALIAS)
-      set_option (OPTFORCEREDRAWINDEX);
+      mutt_set_current_menu_redraw_full ();
   }
 
   mutt_extract_token (buf, s, MUTT_TOKEN_QUOTE | MUTT_TOKEN_SPACE | 
MUTT_TOKEN_SEMICOLON);
@@ -1789,9 +1789,9 @@
   }
 
   if (p->flags & R_INDEX)
-    set_option (OPTFORCEREDRAWINDEX);
+    mutt_set_menu_redraw_full (MENU_MAIN);
   if (p->flags & R_PAGER)
-    set_option (OPTFORCEREDRAWPAGER);
+    mutt_set_menu_redraw_full (MENU_PAGER);
   if (p->flags & R_RESORT_SUB)
     set_option (OPTSORTSUBTHREADS);
   if (p->flags & R_RESORT)
@@ -1804,8 +1804,10 @@
     mutt_reflow_windows ();
 #ifdef USE_SIDEBAR
   if (p->flags & R_SIDEBAR)
-    SidebarNeedsRedraw = 1;
+    mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 #endif
+  if (p->flags & R_MENU)
+    mutt_set_current_menu_redraw_full ();
 }
 
 static size_t escape_string (char *dst, size_t len, const char* src)
@@ -1972,8 +1974,7 @@
 
     if (found)
     {
-      set_option (OPTFORCEREDRAWINDEX);
-      set_option (OPTFORCEREDRAWPAGER);
+      mutt_set_current_menu_redraw_full ();
       mutt_any_key_to_continue (NULL);
       return 0;
     }
@@ -2102,8 +2103,7 @@
        }
        for (idx = 0; MuttVars[idx].option; idx++)
          mutt_restore_default (&MuttVars[idx]);
-       set_option (OPTFORCEREDRAWINDEX);
-       set_option (OPTFORCEREDRAWPAGER);
+       mutt_set_current_menu_redraw_full ();
        set_option (OPTSORTSUBTHREADS);
        set_option (OPTNEEDRESORT);
        set_option (OPTRESORTINIT);
@@ -2569,9 +2569,9 @@
     if (!myvar)
     {
       if (MuttVars[idx].flags & R_INDEX)
-        set_option (OPTFORCEREDRAWINDEX);
+        mutt_set_menu_redraw_full (MENU_MAIN);
       if (MuttVars[idx].flags & R_PAGER)
-        set_option (OPTFORCEREDRAWPAGER);
+        mutt_set_menu_redraw_full (MENU_PAGER);
       if (MuttVars[idx].flags & R_RESORT_SUB)
         set_option (OPTSORTSUBTHREADS);
       if (MuttVars[idx].flags & R_RESORT)
@@ -2584,8 +2584,10 @@
         mutt_reflow_windows ();
 #ifdef USE_SIDEBAR
       if (MuttVars[idx].flags & R_SIDEBAR)
-        SidebarNeedsRedraw = 1;
+        mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 #endif
+      if (MuttVars[idx].flags & R_MENU)
+        mutt_set_current_menu_redraw_full ();
     }
   }
   return (r);
diff -r 6fb6021389c8 -r 8b9bbd983b1a init.h
--- a/init.h    Fri Mar 31 17:29:35 2017 +0200
+++ b/init.h    Fri Mar 31 18:15:31 2017 -0700
@@ -57,14 +57,15 @@
 
 /* forced redraw/resort types */
 #define R_NONE         0
-#define R_INDEX                (1<<0)
-#define R_PAGER                (1<<1)
+#define R_INDEX                (1<<0)  /* redraw the index menu (MENU_MAIN) */
+#define R_PAGER                (1<<1)  /* redraw the pager menu */
 #define R_RESORT       (1<<2)  /* resort the mailbox */
 #define R_RESORT_SUB   (1<<3)  /* resort subthreads */
 #define R_RESORT_INIT  (1<<4)  /* resort from scratch */
 #define R_TREE         (1<<5)  /* redraw the thread tree */
-#define R_REFLOW        (1<<6)  /* reflow window layout */
+#define R_REFLOW        (1<<6)  /* reflow window layout and full redraw */
 #define R_SIDEBAR       (1<<7)  /* redraw the sidebar */
+#define R_MENU          (1<<8)  /* redraw all menus */
 #define R_BOTH         (R_INDEX | R_PAGER)
 #define R_RESORT_BOTH  (R_RESORT | R_RESORT_SUB)
 
@@ -152,7 +153,7 @@
   ** and give it the same color as your attachment color (see also
   ** $$crypt_timestamp).
   */
-  { "arrow_cursor",    DT_BOOL, R_BOTH, OPTARROWCURSOR, 0 },
+  { "arrow_cursor",    DT_BOOL, R_MENU, OPTARROWCURSOR, 0 },
   /*
   ** .pp
   ** When \fIset\fP, an arrow (``->'') will be used to indicate the current 
entry
@@ -405,7 +406,7 @@
   ** When \fIunset\fP, Mutt will not collapse a thread if it contains any
   ** unread messages.
   */
-  { "compose_format",  DT_STR,  R_BOTH, UL &ComposeFormat, UL "-- Mutt: 
Compose  [Approx. msg size: %l   Atts: %a]%>-" },
+  { "compose_format",  DT_STR,  R_MENU, UL &ComposeFormat, UL "-- Mutt: 
Compose  [Approx. msg size: %l   Atts: %a]%>-" },
   /*
   ** .pp
   ** Controls the format of the status line displayed in the ``compose''
@@ -604,7 +605,7 @@
   ** If \fI``no''\fP, never attempt to verify cryptographic signatures.
   ** (Crypto only)
   */
-  { "date_format",     DT_STR,  R_BOTH, UL &DateFmt, UL "!%a, %b %d, %Y at 
%I:%M:%S%p %Z" },
+  { "date_format",     DT_STR,  R_MENU, UL &DateFmt, UL "!%a, %b %d, %Y at 
%I:%M:%S%p %Z" },
   /*
   ** .pp
   ** This variable controls the format of the date printed by the ``%d''
@@ -814,7 +815,7 @@
   ** you use ``+'' or ``='' for any other variables since expansion takes place
   ** when handling the ``$mailboxes'' command.
   */
-  { "folder_format",   DT_STR,  R_INDEX, UL &FolderFormat, UL "%2C %t %N %F 
%2l %-8.8u %-8.8g %8s %d %f" },
+  { "folder_format",   DT_STR,  R_MENU, UL &FolderFormat, UL "%2C %t %N %F %2l 
%-8.8u %-8.8g %8s %d %f" },
   /*
   ** .pp
   ** This variable allows you to customize the file browser display to your
@@ -1006,7 +1007,7 @@
   */
 #endif /* HAVE_GDBM || HAVE_DB4 */
 #endif /* USE_HCACHE */
-  { "help",            DT_BOOL, R_BOTH|R_REFLOW, OPTHELP, 1 },
+  { "help",            DT_BOOL, R_REFLOW, OPTHELP, 1 },
   /*
   ** .pp
   ** When \fIset\fP, help lines describing the bindings for the major functions
@@ -1107,14 +1108,14 @@
   ** Also see $$use_domain and $$hidden_host.
   */
 #ifdef HAVE_LIBIDN
-  { "idn_decode",      DT_BOOL, R_BOTH, OPTIDNDECODE, 1},
+  { "idn_decode",      DT_BOOL, R_MENU, OPTIDNDECODE, 1},
   /*
   ** .pp
   ** When \fIset\fP, Mutt will show you international domain names decoded.
   ** Note: You can use IDNs for addresses even if this is \fIunset\fP.
   ** This variable only affects decoding. (IDN only)
   */
-  { "idn_encode",      DT_BOOL, R_BOTH, OPTIDNENCODE, 1},
+  { "idn_encode",      DT_BOOL, R_MENU, OPTIDNENCODE, 1},
   /*
   ** .pp
   ** When \fIset\fP, Mutt will encode international domain names using
@@ -2837,7 +2838,7 @@
   ** You may optionally use the ``reverse-'' prefix to specify reverse sorting
   ** order (example: ``\fCset sort_browser=reverse-date\fP'').
   */
-  { "sidebar_visible", DT_BOOL, R_BOTH|R_REFLOW, OPTSIDEBAR, 0 },
+  { "sidebar_visible", DT_BOOL, R_REFLOW, OPTSIDEBAR, 0 },
   /*
   ** .pp
   ** This specifies whether or not to show sidebar. The sidebar shows a list of
@@ -2845,7 +2846,7 @@
   ** .pp
   ** \fBSee also:\fP $$sidebar_format, $$sidebar_width
   */
-  { "sidebar_width", DT_NUM, R_BOTH|R_REFLOW, UL &SidebarWidth, 30 },
+  { "sidebar_width", DT_NUM, R_REFLOW, UL &SidebarWidth, 30 },
   /*
   ** .pp
   ** This controls the width of the sidebar.  It is measured in screen columns.
@@ -3493,7 +3494,7 @@
   ** will replace any dots in the expansion by underscores. This might be 
helpful
   ** with IMAP folders that don't like dots in folder names.
   */
-  { "status_on_top",   DT_BOOL, R_BOTH|R_REFLOW, OPTSTATUSONTOP, 0 },
+  { "status_on_top",   DT_BOOL, R_REFLOW, OPTSTATUSONTOP, 0 },
   /*
   ** .pp
   ** Setting this variable causes the ``status bar'' to be displayed on
diff -r 6fb6021389c8 -r 8b9bbd983b1a menu.c
--- a/menu.c    Fri Mar 31 17:29:35 2017 +0200
+++ b/menu.c    Fri Mar 31 18:15:31 2017 -0700
@@ -242,7 +242,7 @@
 #ifdef USE_SIDEBAR
 void menu_redraw_sidebar (MUTTMENU *menu)
 {
-  SidebarNeedsRedraw = 0;
+  menu->redraw &= ~REDRAW_SIDEBAR;
   mutt_sb_draw ();
 }
 #endif
@@ -774,7 +774,16 @@
   }
 }
 
-void mutt_set_current_menu_redraw (void)
+void mutt_set_current_menu_redraw (int redraw)
+{
+  MUTTMENU *current_menu;
+
+  current_menu = get_current_menu ();
+  if (current_menu)
+    current_menu->redraw |= redraw;
+}
+
+void mutt_set_current_menu_redraw_full (void)
 {
   MUTTMENU *current_menu;
 
@@ -783,6 +792,12 @@
     current_menu->redraw = REDRAW_FULL;
 }
 
+void mutt_set_menu_redraw_full (int menu_type)
+{
+  if (CurrentMenu == menu_type)
+    mutt_set_current_menu_redraw_full ();
+}
+
 
 #define MUTT_SEARCH_UP   1
 #define MUTT_SEARCH_DOWN 2
@@ -909,7 +924,7 @@
   if (menu->redraw & REDRAW_STATUS)
     menu_redraw_status (menu);
 #ifdef USE_SIDEBAR
-  if (menu->redraw & REDRAW_SIDEBAR || SidebarNeedsRedraw)
+  if (menu->redraw & REDRAW_SIDEBAR)
     menu_redraw_sidebar (menu);
 #endif
   if (menu->redraw & REDRAW_INDEX)
@@ -1088,12 +1103,6 @@
 
       case OP_ENTER_COMMAND:
        mutt_enter_command ();
-       if (option (OPTFORCEREDRAWINDEX))
-       {
-         menu->redraw = REDRAW_FULL;
-         unset_option (OPTFORCEREDRAWINDEX);
-         unset_option (OPTFORCEREDRAWPAGER);
-       }
        break;
 
       case OP_TAG:
diff -r 6fb6021389c8 -r 8b9bbd983b1a mutt.h
--- a/mutt.h    Fri Mar 31 17:29:35 2017 +0200
+++ b/mutt.h    Fri Mar 31 18:15:31 2017 -0700
@@ -531,8 +531,6 @@
   OPTNEEDRESORT,       /* (pseudo) used to force a re-sort */
   OPTRESORTINIT,       /* (pseudo) used to force the next resort to be from 
scratch */
   OPTVIEWATTACH,       /* (pseudo) signals that we are viewing attachments */
-  OPTFORCEREDRAWINDEX, /* (pseudo) used to force a redraw in the main index */
-  OPTFORCEREDRAWPAGER, /* (pseudo) used to force a redraw in the pager */
   OPTSORTSUBTHREADS,   /* (pseudo) used when $sort_aux changes */
   OPTNEEDRESCORE,      /* (pseudo) set when the `score' command is used */
   OPTATTACHMSG,                /* (pseudo) used by attach-message */
diff -r 6fb6021389c8 -r 8b9bbd983b1a mutt_menu.h
--- a/mutt_menu.h       Fri Mar 31 17:29:35 2017 +0200
+++ b/mutt_menu.h       Fri Mar 31 18:15:31 2017 -0700
@@ -122,7 +122,9 @@
 void mutt_menuDestroy (MUTTMENU **);
 void mutt_push_current_menu (MUTTMENU *);
 void mutt_pop_current_menu (MUTTMENU *);
-void mutt_set_current_menu_redraw ();
+void mutt_set_current_menu_redraw (int);
+void mutt_set_current_menu_redraw_full ();
+void mutt_set_menu_redraw_full (int);
 int mutt_menuLoop (MUTTMENU *);
 
 /* used in both the index and pager index to make an entry. */
diff -r 6fb6021389c8 -r 8b9bbd983b1a pager.c
--- a/pager.c   Fri Mar 31 17:29:35 2017 +0200
+++ b/pager.c   Fri Mar 31 18:15:31 2017 -0700
@@ -1801,10 +1801,9 @@
     }
 
 #ifdef USE_SIDEBAR
-    if ((pager_menu->redraw & REDRAW_SIDEBAR) || SidebarNeedsRedraw)
+    if (pager_menu->redraw & REDRAW_SIDEBAR)
     {
-      SidebarNeedsRedraw = 0;
-      mutt_sb_draw ();
+      menu_redraw_sidebar (pager_menu);
     }
 #endif
 
@@ -2566,10 +2565,6 @@
          ch = 0;
        }
 
-       if (option (OPTFORCEREDRAWPAGER))
-         pager_menu->redraw = REDRAW_FULL;
-       unset_option (OPTFORCEREDRAWINDEX);
-       unset_option (OPTFORCEREDRAWPAGER);
        break;
 
       case OP_FLAG_MESSAGE:
@@ -2691,8 +2686,7 @@
                               (ch == OP_SAVE) || (ch == OP_DECODE_SAVE),
                               (ch == OP_DECODE_SAVE) || (ch == OP_DECODE_COPY),
                               (ch == OP_DECRYPT_SAVE) || (ch == 
OP_DECRYPT_COPY) ||
-                              0,
-                              &pager_menu->redraw) == 0 && (ch == OP_SAVE || 
ch == OP_DECODE_SAVE
+                              0) == 0 && (ch == OP_SAVE || ch == OP_DECODE_SAVE
                                                 || ch == OP_DECRYPT_SAVE
                                                 ))
        {
@@ -2870,7 +2864,6 @@
       case OP_SIDEBAR_TOGGLE_VISIBLE:
        toggle_option (OPTSIDEBAR);
         mutt_reflow_windows();
-       pager_menu->redraw = REDRAW_FULL;
        break;
 #endif
 
diff -r 6fb6021389c8 -r 8b9bbd983b1a protos.h
--- a/protos.h  Fri Mar 31 17:29:35 2017 +0200
+++ b/protos.h  Fri Mar 31 18:15:31 2017 -0700
@@ -309,8 +309,8 @@
 int mutt_parent_message (CONTEXT *, HEADER *, int);
 int mutt_prepare_template(FILE*, CONTEXT *, HEADER *, HEADER *, short);
 int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
-#define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
-int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char 
***, int *);
+#define mutt_enter_fname(A,B,C,D) _mutt_enter_fname(A,B,C,D,0,NULL,NULL)
+int _mutt_enter_fname (const char *, char *, size_t, int, int, char ***, int 
*);
 int  mutt_enter_string (char *buf, size_t buflen, int col, int flags);
 int _mutt_enter_string (char *, size_t, int, int, int, char ***, int *, 
ENTER_STATE *);
 #define mutt_get_field(A,B,C,D) _mutt_get_field(A,B,C,D,0,NULL,NULL)
@@ -360,7 +360,7 @@
 int mutt_query_variables (LIST *queries);
 int mutt_save_attachment (FILE *, BODY *, char *, int, HEADER *);
 int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
-int mutt_save_message (HEADER *, int, int, int, int *);
+int mutt_save_message (HEADER *, int, int, int);
 int mutt_search_command (int, int);
 #ifdef USE_SMTP
 int mutt_smtp_send (const ADDRESS *, const ADDRESS *, const ADDRESS *,
diff -r 6fb6021389c8 -r 8b9bbd983b1a score.c
--- a/score.c   Fri Mar 31 17:29:35 2017 +0200
+++ b/score.c   Fri Mar 31 18:15:31 2017 -0700
@@ -21,6 +21,7 @@
 #endif
 
 #include "mutt.h"
+#include "mutt_menu.h"
 #include "sort.h"
 #include <string.h>
 #include <stdlib.h>
@@ -51,8 +52,8 @@
     }
 
     /* must redraw the index since the user might have %N in it */
-    set_option (OPTFORCEREDRAWINDEX);
-    set_option (OPTFORCEREDRAWPAGER);
+    mutt_set_menu_redraw_full (MENU_MAIN);
+    mutt_set_menu_redraw_full (MENU_PAGER);
 
     for (i = 0; ctx && i < ctx->msgcount; i++)
     {
diff -r 6fb6021389c8 -r 8b9bbd983b1a sidebar.c
--- a/sidebar.c Fri Mar 31 17:29:35 2017 +0200
+++ b/sidebar.c Fri Mar 31 18:15:31 2017 -0700
@@ -909,7 +909,7 @@
     default:
       return;
   }
-  SidebarNeedsRedraw = 1;
+  mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 }
 
 /**
@@ -1048,5 +1048,5 @@
       Entries[del_index] = Entries[del_index + 1];
   }
 
-  SidebarNeedsRedraw = 1;
+  mutt_set_current_menu_redraw (REDRAW_SIDEBAR);
 }

Reply via email to