]> granicus.if.org Git - neomutt/commitdiff
Add ability to limit levels hidden with toggle-quoted command
authorDarren Kenny <darren.kenny@oracle.com>
Mon, 2 Sep 2019 11:34:26 +0000 (12:34 +0100)
committerPietro Cerutti <gahr@gahr.ch>
Fri, 11 Oct 2019 11:39:10 +0000 (11:39 +0000)
Closes: #1802
By setting the configuration variable `toggle_quoted_show_levels`, when you
execute the `toggle-quoted` command, the specified number of levels
will continue to be visible.

doc/manual.xml.head
globals.h
init.h
pager.c

index ddd58d1e43c4d26222d1fcfbdddaab192de012ba..f1f0f1d406f2dfb986986879852a9e4fe8065ff5 100644 (file)
@@ -2503,6 +2503,12 @@ color sidebar_divider   color8  default     <emphasis role="comment"># Dark grey
                 just the response and there is a large amount of quoted text in
                 the way.
               </para>
+              <para>
+                The variable
+                <link linkend="toggle-quoted-show-levels">$toggle_quoted_show_levels</link>
+                can be used to show some context by continuing to show that number of levels
+                rather than hiding all quoted levels.
+              </para>
             </listitem>
           </varlistentry>
           <varlistentry>
index 755b74bcad2402f0ce8854b7e264aed466b4baa9..71c62c038d82dae3aa6d22b06f71e7f873f13ac7 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -177,6 +177,7 @@ WHERE char *C_NmQueryWindowCurrentSearch;    ///< Config: (notmuch) Current sear
 /* These variables are backing for config items */
 WHERE struct Regex *C_Mask;                  ///< Config: Only display files/dirs matching this regex in the browser
 WHERE struct Regex *C_QuoteRegex;            ///< Config: Regex to match quoted text in a reply
+WHERE int C_ToggleQuotedShowLevels;          ///< Config: Number of quote levels to show with toggle-quoted
 
 /* Quad-options */
 WHERE unsigned char C_Bounce;                ///< Config: Confirm before bouncing a message
diff --git a/init.h b/init.h
index 01b387ec07d0274dfeee7adaa98bc88166b59db4..4b53a9ece870c9e2c7c3041568d90377945ff28a 100644 (file)
--- a/init.h
+++ b/init.h
@@ -3279,6 +3279,13 @@ struct ConfigDef MuttVars[] = {
   ** .pp
   ** Match detection may be overridden by the $$smileys regular expression.
   */
+  { "toggle_quoted_show_levels", DT_NUMBER|DT_NOT_NEGATIVE, &C_ToggleQuotedShowLevels, 0 },
+  /*
+  ** .pp
+  ** Quoted text may be filtered out using the \fC<toggle-quoted>\fP command.
+  ** If set to a number greater than 0, then the \fC<toggle-quoted>\fP
+  ** command will only filter out quote levels above this number.
+  */
   { "read_inc", DT_NUMBER|DT_NOT_NEGATIVE, &C_ReadInc, 10 },
   /*
   ** .pp
diff --git a/pager.c b/pager.c
index d7f9f96484c46fa2d5a6c8520d6789bd50f3cb67..45184f7ff780f53b4e1bd778d06cbfeaeee671be 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1712,8 +1712,11 @@ static int display_line(FILE *fp, LOFF_T *last_pos, struct Line **line_info,
     }
 
     /* this also prevents searching through the hidden lines */
-    if ((flags & MUTT_HIDE) && ((*line_info)[n].type == MT_COLOR_QUOTED))
+    if ((flags & MUTT_HIDE) && ((*line_info)[n].type == MT_COLOR_QUOTED) &&
+        (((*line_info)[n].quote == NULL) ||
+         ((*line_info)[n].quote->index >= C_ToggleQuotedShowLevels))) {
       flags = 0; /* MUTT_NOSHOW */
+    }
   }
 
   /* At this point, (*line_info[n]).quote may still be undefined. We