Add R_SIDEBAR to redraw sidebar when its settings change.
authorKevin McCarthy <kevin@8t8.us>
Sat, 2 Jul 2016 19:25:59 +0000 (12:25 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 2 Jul 2016 19:25:59 +0000 (12:25 -0700)
Add to the sidebar settings that control formatting of the sidebar.

init.c
init.h

diff --git a/init.c b/init.c
index 04d668595cf32ca25805045ba81d5211872f8bc2..69c484e5fa898c5781e4c5d91be877f234ac6642 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1613,6 +1613,10 @@ static void mutt_restore_default (struct option_t *p)
     set_option (OPTREDRAWTREE);
   if (p->flags & R_REFLOW)
     mutt_reflow_windows ();
+#ifdef USE_SIDEBAR
+  if (p->flags & R_SIDEBAR)
+    SidebarNeedsRedraw = 1;
+#endif
 }
 
 static size_t escape_string (char *dst, size_t len, const char* src)
@@ -2233,6 +2237,10 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
         set_option (OPTREDRAWTREE);
       if (MuttVars[idx].flags & R_REFLOW)
         mutt_reflow_windows ();
+#ifdef USE_SIDEBAR
+      if (MuttVars[idx].flags & R_SIDEBAR)
+        SidebarNeedsRedraw = 1;
+#endif
     }
   }
   return (r);
diff --git a/init.h b/init.h
index 09f55a71efb24e22aa1a9b7ce57b6d27d1b6c9da..e77a166df22cd8e841e9639c5a60fb9729e50c60 100644 (file)
--- a/init.h
+++ b/init.h
@@ -63,6 +63,7 @@
 #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_SIDEBAR       (1<<7)  /* redraw the sidebar */
 #define R_BOTH         (R_INDEX | R_PAGER)
 #define R_RESORT_BOTH  (R_RESORT | R_RESORT_SUB)
 
@@ -2684,14 +2685,14 @@ struct option_t MuttVars[] = {
   ** shell from \fC/etc/passwd\fP is used.
   */
 #ifdef USE_SIDEBAR
-  { "sidebar_divider_char", DT_STR, R_BOTH, UL &SidebarDividerChar, UL "|" },
+  { "sidebar_divider_char", DT_STR, R_SIDEBAR, UL &SidebarDividerChar, UL "|" },
   /*
   ** .pp
   ** This specifies the characters to be drawn between the sidebar (when
   ** visible) and the other Mutt panels. ASCII and Unicode line-drawing
   ** characters are supported.
   */
-  { "sidebar_delim_chars", DT_STR, R_NONE, UL &SidebarDelimChars, UL "/." },
+  { "sidebar_delim_chars", DT_STR, R_SIDEBAR, UL &SidebarDelimChars, UL "/." },
   /*
   ** .pp
   ** This contains the list of characters which you would like to treat
@@ -2709,14 +2710,14 @@ struct option_t MuttVars[] = {
   ** .pp
   ** \fBSee also:\fP $$sidebar_short_path, $$sidebar_folder_indent, $$sidebar_indent_string.
   */
-  { "sidebar_folder_indent", DT_BOOL, R_BOTH, OPTSIDEBARFOLDERINDENT, 0 },
+  { "sidebar_folder_indent", DT_BOOL, R_SIDEBAR, OPTSIDEBARFOLDERINDENT, 0 },
   /*
   ** .pp
   ** Set this to indent mailboxes in the sidebar.
   ** .pp
   ** \fBSee also:\fP $$sidebar_short_path, $$sidebar_indent_string, $$sidebar_delim_chars.
   */
-  { "sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%*  %n" },
+  { "sidebar_format", DT_STR, R_SIDEBAR, UL &SidebarFormat, UL "%B%*  %n" },
   /*
   ** .pp
   ** This variable allows you to customize the sidebar display. This string is
@@ -2747,7 +2748,7 @@ struct option_t MuttVars[] = {
   ** be \fIset\fP.  When thus set, a suggested value for this option is
   ** "%B%?F? [%F]?%* %?N?%N/?%S".
   */
-  { "sidebar_indent_string", DT_STR, R_BOTH, UL &SidebarIndentString, UL "  " },
+  { "sidebar_indent_string", DT_STR, R_SIDEBAR, UL &SidebarIndentString, UL "  " },
   /*
   ** .pp
   ** This specifies the string that is used to indent mailboxes in the sidebar.
@@ -2755,7 +2756,7 @@ struct option_t MuttVars[] = {
   ** .pp
   ** \fBSee also:\fP $$sidebar_short_path, $$sidebar_folder_indent, $$sidebar_delim_chars.
   */
-  { "sidebar_new_mail_only", DT_BOOL, R_BOTH, OPTSIDEBARNEWMAILONLY, 0 },
+  { "sidebar_new_mail_only", DT_BOOL, R_SIDEBAR, OPTSIDEBARNEWMAILONLY, 0 },
   /*
   ** .pp
   ** When set, the sidebar will only display mailboxes containing new, or
@@ -2763,7 +2764,7 @@ struct option_t MuttVars[] = {
   ** .pp
   ** \fBSee also:\fP $sidebar_whitelist.
   */
-  { "sidebar_next_new_wrap", DT_BOOL, R_BOTH, UL OPTSIDEBARNEXTNEWWRAP, 0 },
+  { "sidebar_next_new_wrap", DT_BOOL, R_NONE, UL OPTSIDEBARNEXTNEWWRAP, 0 },
   /*
   ** .pp
   ** When set, the \fC<sidebar-next-new>\fP command will not stop and the end of
@@ -2771,7 +2772,7 @@ struct option_t MuttVars[] = {
   ** \fC<sidebar-prev-new>\fP command is similarly affected, wrapping around to
   ** the end of the list.
   */
-  { "sidebar_short_path", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
+  { "sidebar_short_path", DT_BOOL, R_SIDEBAR, OPTSIDEBARSHORTPATH, 0 },
   /*
   ** .pp
   ** By default the sidebar will show the mailbox's path, relative to the
@@ -2787,7 +2788,7 @@ struct option_t MuttVars[] = {
   ** .pp
   ** \fBSee also:\fP $$sidebar_delim_chars, $$sidebar_folder_indent, $$sidebar_indent_string.
   */
-  { "sidebar_sort_method", DT_SORT|DT_SORT_SIDEBAR, R_NONE, UL &SidebarSortMethod, SORT_ORDER },
+  { "sidebar_sort_method", DT_SORT|DT_SORT_SIDEBAR, R_SIDEBAR, UL &SidebarSortMethod, SORT_ORDER },
   /*
   ** .pp
   ** Specifies how to sort entries in the file browser.  By default, the