fst->spaces = 0;
}
+/* Calculate the paragraph width based upon the current quote level. The start
+ * of a quoted line will be ">>> ", so we need to subtrace the space required
+ * for the prefix from the terminal width. */
static int quote_width (STATE *s, int ql)
{
- size_t width = (Wrap ? mutt_term_width (Wrap) : FLOWED_MAX) - 1;
- if (s->flags & M_REPLYING && width > FLOWED_MAX)
- width = FLOWED_MAX;
- if (ql + 1 < width)
- width -= ql + 1;
+ int width = mutt_term_width (Wrap);
+ if (option(OPTTEXTFLOWED) && (s->flags & M_REPLYING))
+ {
+ /* When replying, force a wrap at FLOWED_MAX to comply with RFC3676
+ * guidelines */
+ if (width > FLOWED_MAX)
+ width = FLOWED_MAX;
+ ++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
+ * string and the paragraph */
+ if ((s->flags & M_REPLYING) == 0 && ql > 0)
+ --width;
+ /* failsafe for really long quotes */
+ if (width <= 0)
+ width = FLOWED_MAX; /* arbitrary, since the line will wrap */
return width;
}