Re: [Mutt] #2898: mutt-1.5.14: mutt's pager should strip spurrious
#2898: mutt-1.5.14: mutt's pager should strip spurrious ^M, most of the time
---------------------------------------------+------------------------------
Reporter: John Hawkinson <jhawk@xxxxxxx> | Owner: UNKNOWN
Type: defect | Status: new
Priority: minor | Milestone:
Component: display | Version: 1.5.14
Resolution: | Keywords: pager patch
---------------------------------------------+------------------------------
Old description:
> {{{
> Package: mutt
> Version: 1.5.15
> Severity: wishlist
>
> Some domains seem to manage to send e-mail where every linebreak is a
> \r\n. I'm not sure why they do this. The only one I've encountered
> with great regularity is DOLBY.COM, though there was one other I got
> last week that I seem to've misplaced, but it caused me to put this
> on my queue. They only seem to arrive in quoted-printable...
>
> Anyhow, mutt's pager displays these messages with a ^M at the end of
> each line, which really looks awkward and hard to read, e.g.:
>
> Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do^M
> eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad^M
> minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip^M
> ex ea commodo consequat. Duis aute irure dolor in reprehenderit in^M
> voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur^M
> sint occaecat cupidatat non proident, sunt in culpa qui officia^M
>
> (Okay, it's worse when you're actually reading the language across
> the line break.)
>
> Attached is a patch such that mutt throws away ^Ms unless OPTWEED is
> set, so that if you turn on full headers ('h'), these ^Ms are
> displayed. If you'd prefer to handle it a different way, let me know
> and I will re-spin the patch.
>
> Previously, mutt unconditionally escaped all \r chars as "^M".
>
> I realize this is the sender's fault, but I don't think I should have
> to put up with it. (I could fix this with a display_filter,
> but then it would be harder to toggle, I'd pay a fork penalty,
> and other mutt users wouldn't get the benefit).
>
> (I realize the patch uses a goto -- I do think it's clearer to add an
> elsif stanza for the \r case and use a goto to the control-character
> label, rather either duplicating the control-char printing code in \r
> stanza, or adding
> || wc=='\r' && !option(OPTWEED)
> to the control characer case (line 1184, wc < 0x20...).
> If you'd prefer a goto-less version, I can do that too...)
>
> --- /afs/sipb.mit.edu/project/sipb/src/mutt/mutt-1.5.15/pager.c Sun Apr
> 1 17:58:56 2007
> +++ mutt-1.5.15/pager.c Mon May 28 22:59:28 2007
> @@ -1175,8 +1175,15 @@
> else
> col = t;
> }
> + else if (wc == '\r')
> + {
> + if (!option(OPTWEED)) {
> + goto controlchar;
> + }
> + }
> else if (wc < 0x20 || wc == 0x7f)
> {
> + controlchar:
> if (col + 2 > wrap_cols)
> break;
> col += 2;
>
> 2007-05-28 22:59 -0400 John Hawkinson <jhawk@xxxxxxx>
>
> * pager.c: Hide ^Ms in messages when OPTWEED ('h': suppress full
> headers) is set. For those rare people who get email with
> linebreaks
> ending in \r\n.
>
> Thanks.
>
> --jhawk@xxxxxxx
> John Hawkinson
> }}}
New description:
{{{
Package: mutt
Version: 1.5.15
Severity: wishlist
Some domains seem to manage to send e-mail where every linebreak is a
\r\n. I'm not sure why they do this. The only one I've encountered
with great regularity is DOLBY.COM, though there was one other I got
last week that I seem to've misplaced, but it caused me to put this
on my queue. They only seem to arrive in quoted-printable...
Anyhow, mutt's pager displays these messages with a ^M at the end of
each line, which really looks awkward and hard to read, e.g.:
Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do^M
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad^M
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip^M
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in^M
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur^M
sint occaecat cupidatat non proident, sunt in culpa qui officia^M
(Okay, it's worse when you're actually reading the language across
the line break.)
Attached is a patch such that mutt throws away ^Ms unless OPTWEED is
set, so that if you turn on full headers ('h'), these ^Ms are
displayed. If you'd prefer to handle it a different way, let me know
and I will re-spin the patch.
Previously, mutt unconditionally escaped all \r chars as "^M".
I realize this is the sender's fault, but I don't think I should have
to put up with it. (I could fix this with a display_filter,
but then it would be harder to toggle, I'd pay a fork penalty,
and other mutt users wouldn't get the benefit).
(I realize the patch uses a goto -- I do think it's clearer to add an
elsif stanza for the \r case and use a goto to the control-character
label, rather either duplicating the control-char printing code in \r
stanza, or adding
|| wc=='\r' && !option(OPTWEED)
to the control characer case (line 1184, wc < 0x20...).
If you'd prefer a goto-less version, I can do that too...)
--- /afs/sipb.mit.edu/project/sipb/src/mutt/mutt-1.5.15/pager.c Sun Apr 1
17:58:56 2007
+++ mutt-1.5.15/pager.c Mon May 28 22:59:28 2007
@@ -1175,8 +1175,15 @@
else
col = t;
}
+ else if (wc == '\r')
+ {
+ if (!option(OPTWEED)) {
+ goto controlchar;
+ }
+ }
else if (wc < 0x20 || wc == 0x7f)
{
+ controlchar:
if (col + 2 > wrap_cols)
break;
col += 2;
2007-05-28 22:59 -0400 John Hawkinson <jhawk@xxxxxxx>
* pager.c: Hide ^Ms in messages when OPTWEED ('h': suppress full
headers) is set. For those rare people who get email with
linebreaks
ending in \r\n.
Thanks.
--jhawk@xxxxxxx
John Hawkinson
}}}
--
Comment(by pdmef):
That's the case for me: MIME-encoded CRLF remain and others are stripped.
Since the OP mentions that these broken mails only arrive in quoted-
printable, I guess the line endings are MIME-encoded. I.e. no mutt bug,
I'd say.
--
Ticket URL: <http://dev.mutt.org/trac/ticket/2898#comment:4>
Mutt <http://www.mutt.org/>
The Mutt mail user agent