changeset: 6540:e52d3e9c83d8
user: Kevin McCarthy <[email protected]>
date: Tue Dec 15 15:29:56 2015 -0800
link: http://dev.mutt.org/hg/mutt/rev/e52d3e9c83d8
Add $reflow_space_quotes option. (closes #3309)
When viewing and replying to a flowed email, add spacing between the
quotes to improve readability and interoperability with non-flowed
replies.
Add a section to the documentation discussing support for viewing and
non-flowed replies to flowed emails.
diffs (189 lines):
diff -r 02bc14ed1569 -r e52d3e9c83d8 doc/manual.xml.head
--- a/doc/manual.xml.head Tue Dec 08 09:12:09 2015 -0800
+++ b/doc/manual.xml.head Tue Dec 15 15:29:56 2015 -0800
@@ -1612,6 +1612,44 @@
</sect3>
+<sect3 id="ff-pager">
+<title>Support for viewing and non-flowed replies</title>
+
+<para>
+ Mutt has some support for viewing and replying to
+ <literal>format=flowed</literal> messages. In order to take advantage of
these,
+ <link linkend="reflow-text">$reflow_text</link> must be set.
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+ Paragraphs are automatically reflowed and wrapped at a width specified
+ by <link linkend="reflow-wrap">$reflow_wrap</link>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ By default, the quoting style of <literal>format=flowed</literal>
+ messages can be difficult to read, and doesn't intermix well with
+ non-flowed replies.
+ Setting <link linkend="reflow-space-quotes">$reflow_space_quotes</link>
+ adds spaces after each level of quoting when in the pager and
+ replying in a non-flowed format
+ (i.e. with <link linkend="text-flowed">$text_flowed</link> unset).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If <link linkend="reflow-space-quotes">$reflow_space_quotes</link>
+ is unset, mutt will still add one trailing space after all the
+ quotes in the pager (but not when replying).
+ </para>
+ </listitem>
+</itemizedlist>
+
+</sect3>
+
</sect2>
</sect1>
diff -r 02bc14ed1569 -r e52d3e9c83d8 init.h
--- a/init.h Tue Dec 08 09:12:09 2015 -0800
+++ b/init.h Tue Dec 15 15:29:56 2015 -0800
@@ -2380,6 +2380,17 @@
** The value of \fI$$record\fP is overridden by the $$force_name and
** $$save_name variables, and the ``$fcc-hook'' command.
*/
+ { "reflow_space_quotes", DT_BOOL, R_NONE, OPTREFLOWSPACEQUOTES, 1 },
+ /*
+ ** .pp
+ ** This option controls how quotes from format=flowed messages are displayed
+ ** in the pager and when replying (with $$text_flowed \fIunset\fP).
+ ** When set, this option adds spaces after each level of quote marks, turning
+ ** ">>>foo" into "> > > foo".
+ ** .pp
+ ** \fBNote:\fP If $$reflow_text is \fIunset\fP, this option has no effect.
+ ** Also, this option does not affect replies when $$text_flowed is \fIset\fP.
+ */
{ "reflow_text", DT_BOOL, R_NONE, OPTREFLOWTEXT, 1 },
/*
** .pp
diff -r 02bc14ed1569 -r e52d3e9c83d8 mutt.h
--- a/mutt.h Tue Dec 08 09:12:09 2015 -0800
+++ b/mutt.h Tue Dec 15 15:29:56 2015 -0800
@@ -409,6 +409,7 @@
OPTPRINTSPLIT,
OPTPROMPTAFTER,
OPTREADONLY,
+ OPTREFLOWSPACEQUOTES,
OPTREFLOWTEXT,
OPTREPLYSELF,
OPTRESOLVE,
diff -r 02bc14ed1569 -r e52d3e9c83d8 rfc3676.c
--- a/rfc3676.c Tue Dec 08 09:12:09 2015 -0800
+++ b/rfc3676.c Tue Dec 15 15:29:56 2015 -0800
@@ -61,7 +61,46 @@
return quoted;
}
-static size_t print_indent (int ql, STATE *s, int sp)
+/* Determines whether to add spacing between/after each quote level:
+ * >>>foo
+ * becomes
+ * > > > foo
+ */
+static int space_quotes (STATE *s)
+{
+ /* Allow quote spacing in the pager even for OPTTEXTFLOWED,
+ * but obviously not when replying.
+ */
+ if (option (OPTTEXTFLOWED) && (s->flags & M_REPLYING))
+ return 0;
+
+ return option (OPTREFLOWSPACEQUOTES);
+}
+
+/* Determines whether to add a trailing space to quotes:
+ * >>> foo
+ * as opposed to
+ * >>>foo
+ */
+static int add_quote_suffix (STATE *s, int ql)
+{
+ if (s->flags & M_REPLYING)
+ return 0;
+
+ if (space_quotes (s))
+ return 0;
+
+ if (!ql && !s->prefix)
+ return 0;
+
+ /* The prefix will add its own space */
+ if (!option (OPTTEXTFLOWED) && !ql && s->prefix)
+ return 0;
+
+ return 1;
+}
+
+static size_t print_indent (int ql, STATE *s, int add_suffix)
{
int i;
size_t wid = 0;
@@ -77,14 +116,21 @@
{
state_puts (s->prefix, s);
wid = mutt_strwidth (s->prefix);
- sp = 0;
}
}
for (i = 0; i < ql; i++)
+ {
state_putc ('>', s);
- if (sp)
+ if (space_quotes (s) )
+ state_putc (' ', s);
+ }
+ if (add_suffix)
state_putc (' ', s);
- return ql + sp + wid;
+
+ if (space_quotes (s))
+ ql *= 2;
+
+ return ql + add_suffix + wid;
}
static void flush_par (STATE *s, flowed_state_t *fst)
@@ -112,10 +158,10 @@
++ql; /* When replying, we will add an additional quote level */
}
/* adjust the paragraph width subtracting the number of prefix chars */
- width -= ql;
- /* When displaying (not replying), there will be a space between the prefix
+ width -= space_quotes (s) ? ql*2 : ql;
+ /* When displaying (not replying), there may be a space between the prefix
* string and the paragraph */
- if ((s->flags & M_REPLYING) == 0 && ql > 0)
+ if (add_quote_suffix (s, ql))
--width;
/* failsafe for really long quotes */
if (width <= 0)
@@ -183,8 +229,7 @@
}
if (!words && !fst->width)
- fst->width = print_indent (ql, s, !(s->flags & M_REPLYING) &&
- (ql > 0 || s->prefix));
+ fst->width = print_indent (ql, s, add_quote_suffix (s, ql));
fst->width += w + fst->spaces;
for ( ; fst->spaces; fst->spaces--)
state_putc (' ', s);
@@ -199,7 +244,7 @@
static void print_fixed_line (const char *line, STATE *s, int ql,
flowed_state_t *fst)
{
- print_indent (ql, s, !(s->flags & M_REPLYING) && (ql > 0 || s->prefix));
+ print_indent (ql, s, add_quote_suffix (s, ql));
if (line && *line)
state_puts (line, s);
state_putc ('\n', s);