<<< Date Index >>>     <<< Thread Index >>>

[PATCH] display hints to show location of hidden quoted text



The attached patch (based on 1.5.17) does two things:

(1) Creates a "hide_quoted" mutt variable for controlling whether
quoted text hiding is enabled.  This allows mutt to be configured to
always hide quoted text by default; and any toggling of this option
persists between messages.

(2) Changes the quoted text hiding code so that a marker is left in
place so that you get a hint as to where quoted text has been hidden.
That marker consists of the first line of quoted text being filled in
with the hidden_quote string (configurable, but defaults to a line
of ">>>>").

This patch could be considered either a partial or complete fix for
ticket #1142.  Personally, I think it's a pretty simple patch that
gets us 90% of that requested feature.  It could use some polish though.
For example, the marker used as the hint is only as long as the first
line of the block of quoted text.  Also, if people prefer the old/current
behavior of NOT seeing the hints, we'd probably need to implement an
additional variable specifically controlling the display of the hint
markers.  I could easily add that, if requested.

Anyway, I've found it to be extremely useful the past couple months
and figure others might find it useful as well.

Thanks
--macko
diff -ur mutt-1.5.17/PATCHES mutt-1.5.17.hint_quoted/PATCHES
--- mutt-1.5.17/PATCHES 2007-03-21 11:26:38.000000000 -0700
+++ mutt-1.5.17.hint_quoted/PATCHES     2008-01-09 23:08:52.000000000 -0800
@@ -0,0 +1 @@
+patch-1.5.17.mm.hint_quoted.20080109.txt
diff -ur mutt-1.5.17/globals.h mutt-1.5.17.hint_quoted/globals.h
--- mutt-1.5.17/globals.h       2007-04-12 13:44:40.000000000 -0700
+++ mutt-1.5.17.hint_quoted/globals.h   2008-01-09 23:08:08.000000000 -0800
@@ -53,6 +53,7 @@
 WHERE char *ForwFmt;
 WHERE char *Fqdn;
 WHERE char *HdrFmt;
+WHERE char *HiddenQuote;
 WHERE char *HistFile;
 WHERE char *Homedir;
 WHERE char *Hostname;
diff -ur mutt-1.5.17/init.h mutt-1.5.17.hint_quoted/init.h
--- mutt-1.5.17/init.h  2007-10-31 10:48:52.000000000 -0700
+++ mutt-1.5.17.hint_quoted/init.h      2008-01-09 23:08:08.000000000 -0800
@@ -743,6 +743,12 @@
   ** running.  Since this variable is primarily aimed at new users, neither
   ** of these should present a major problem.
   */
+  { "hidden_quote",    DT_STR, R_PAGER, UL &HiddenQuote, UL 
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" },
+  /*
+  ** .pp
+  ** The string Mutt's internal-pager will use to fill the first line of
+  ** hidden quoted text in the body of a message.
+  */
   { "hidden_host",     DT_BOOL, R_NONE, OPTHIDDENHOST, 0 },
   /*
   ** .pp
@@ -763,6 +769,12 @@
   ** When set, mutt will not show the presence of missing messages in the
   ** thread tree.
   */
+  { "hide_quoted",     DT_BOOL, R_PAGER, OPTHIDEQUOTED, 0 },
+  /*
+  ** .pp
+  ** When set, Mutt's internal-pager will hide quoted text in the body
+  ** of a message.
+  */
   { "hide_thread_subject", DT_BOOL, R_TREE|R_INDEX, OPTHIDETHREADSUBJECT, 1 },
   /*
   ** .pp
diff -ur mutt-1.5.17/mutt.h mutt-1.5.17.hint_quoted/mutt.h
--- mutt-1.5.17/mutt.h  2007-08-28 10:44:16.000000000 -0700
+++ mutt-1.5.17.hint_quoted/mutt.h      2008-01-09 23:08:08.000000000 -0800
@@ -369,6 +369,7 @@
   OPTHIDDENHOST,
   OPTHIDELIMITED,
   OPTHIDEMISSING,
+  OPTHIDEQUOTED,
   OPTHIDETHREADSUBJECT,
   OPTHIDETOPLIMITED,
   OPTHIDETOPMISSING,
diff -ur mutt-1.5.17/pager.c mutt-1.5.17.hint_quoted/pager.c
--- mutt-1.5.17/pager.c 2007-09-05 11:28:05.000000000 -0700
+++ mutt-1.5.17.hint_quoted/pager.c     2008-01-09 23:08:08.000000000 -0800
@@ -1281,7 +1281,8 @@
     }
 
     /* this also prevents searching through the hidden lines */
-    if ((flags & M_HIDE) && (*lineInfo)[n].type == MT_COLOR_QUOTED)
+    if ((flags & M_HIDE) && ((*lineInfo)[n].type == MT_COLOR_QUOTED) &&
+        (n > 0) && ((*lineInfo)[n-1].type == MT_COLOR_QUOTED))
       flags = 0; /* M_NOSHOW */
   }
 
@@ -1358,6 +1359,13 @@
     return (-1);
   }
 
+  if ((flags & M_HIDE) && ((*lineInfo)[n].type == MT_COLOR_QUOTED))
+  {
+    /* contents of first hidden line get replaced */
+    sprintf(buf, "%-*s", b_read, HiddenQuote);
+    sprintf(fmt, "%-*s", b_read, HiddenQuote);
+  }
+
   /* now chose a good place to break the line */
   cnt = format_line (lineInfo, n, buf, flags, 0, b_read, &ch, &vch, &col, 
&special);
   buf_ptr = buf + cnt;
@@ -1507,7 +1515,7 @@
   int maxLine, lastLine = 0;
   struct line_t *lineInfo;
   struct q_class_t *QuoteList = NULL;
-  int i, j, ch = 0, rc = -1, hideQuoted = 0, q_level = 0, force_redraw = 0;
+  int i, j, ch = 0, rc = -1, hideQuoted, q_level = 0, force_redraw = 0;
   int lines = 0, curline = 0, topline = 0, oldtopline = 0, err, first = 1;
   int r = -1;
   int redraw = REDRAW_FULL;
@@ -1530,6 +1538,7 @@
   int indicator = indexlen / 3;        /* the indicator line of the PI */
   int old_PagerIndexLines;             /* some people want to resize it
                                         * while inside the pager... */
+  hideQuoted = option(OPTHIDEQUOTED) ? M_HIDE : 0;
 
   if (!(flags & M_SHOWCOLOR))
     flags |= M_SHOWFLAT;
@@ -2140,7 +2149,8 @@
       case OP_PAGER_HIDE_QUOTED:
        if (has_types)
        {
-         hideQuoted ^= M_HIDE;
+         toggle_option(OPTHIDEQUOTED);
+         hideQuoted = option(OPTHIDEQUOTED) ? M_HIDE : 0;
          if (hideQuoted && lineInfo[topline].type == MT_COLOR_QUOTED)
            topline = upNLines (1, lineInfo, topline, hideQuoted);
          else