Open Bug 249082 Opened 20 years ago Updated 2 years ago

Rewrap behavior on quoted blocks in HTML is unexpected

Categories

(MailNews Core :: Composition, defect)

x86
Windows 2000
defect

Tracking

(Not tracked)

People

(Reporter: mcow, Unassigned)

References

(Blocks 1 open bug)

Details

Applying Rewrap to a quoted text in an HTML composition results in what I consider to be undesirable modification to the text: each line is prefixed with a &gt; entity (">"), and the <blockquote> is replaced with a <span>. See attachments at bug 237558 for sample messages that can be replied to. Steps to reproduce: 1) Integrate the mail message into your mail system (add a "From -" line to the beginning and copy into a mail account directory without the .eml extension). 2) In Mozilla, Select the message, reply in HTML mode (use shift+toolbutton if needed) 3) Save the message as a draft 4) Open a source view window of the draft 5) Select Edit|Rewrap -- observe the new ">" characters in the quote 6) Save the message again 7) Open another source view window of the new draft 8) Compare the HTML structure of the quoted block. CASE 1: unflowed plain text (attachment 151950 [details]) == original message source has quote as: <blockquote cite="[...]" type="cite"> <pre wrap="">And mushtari they flung in my; fears tomorrow why tomorrow [...] [...text continues...] </pre> </blockquote> CASE 2: format=flowed plain text (attachment 151951 [details]) or HTML (attachment 151949 [details]) == original message source has quote as: <blockquote cite="[...]" type="cite">And mushtari they flung in my; fears tomorrow why tomorrow I may be. [...] [... text continues ...] <br> <br> </blockquote> BOTH CASES: rewrapped source has quote as follows (note the wrap break in the first line of the <span>): <span style="white-space: pre;">&gt; And mushtari they flung in my; fears tomorrow why tomorrow I may be.<br> &gt;[... text continues ...] &gt;</span> Expected results: 1) No quote-char entities added to quote 2) <blockquote> maintained 3) "whitespace:pre" is *not* introduced 4) <br> tags not added to rewrapped line ends In the composition window, these results are visible as: - the "quote bar" being replaced with a series of ">" characters, and - the color of the quote transforming entirely to blue, instead of just the bar being blue. - the quote does not reflow when the window is resized In the received-message window, these results are visible as: - When the message is sent as HTML, the quoted text does not reflow when the message window is resized, due to the <BR>s as well as the white-space styling. Any breaks induced by wrapping the long lines to fit the mail are visible within the <span> because of "white-space:pre" (when using View As Original HTML; view As Simple does not show this problem). - When sending as f=f text, the trailing spaces on the lines are omitted after the Rewrap (see bug 220575) and so, again, the received message's quote does not reflow on window resize. - When sending as plain text, the source actually ends up basically the same whether the text was rewrapped or not; the primary difference is that the rewrapped HTML ends up converted with two spaces between the ">" and the start of the text. Finally: I do think that the CASE 1 behavior of removing the <pre> tag is sensible: if the text is being reflowed, obviously the <pre> formatting was unnecessary. In fact, I think that's the only useful application of Rewrap in HTML composition.
> In fact, I think that's the only useful application of Rewrap in > HTML composition. I suspect the biggest reason for Rewrap in html composition is when replying to a plaintext message which has lines wrapped to odd lengths, like 100 columns, and you want to send out mail where even the quote is wrapped more reasonably. Or consider: A sends plaintext mail wrapped to 120 columns, B replies and quotes A but B has a line length of 60 columns. Now C replies to the mail in mozilla, and the resulting quote is comb-wrapped. Rewrapping would fix that. I can see an argument for requesting that all plaintext quotes be converted to html type quotes when rewrapping from an html window (in the sense that they're put inside appropriate levels of blockquote, to be wrapped appropriately at send time) instead of rewrapping the text as plaintext. Is that what you're asking for here? nsHTMLEditor::Rewrap currently just calls nsPlaintextEditor::Rewrap, but could be rewritten to do something different. The citers have StripCitesAndLinebreaks, which you could use for this purpose (you'd have to be careful about noticing when the cite level changes, don't just strip all cites from the whole block).
(In reply to comment #1) > > In fact, I think that's the only useful application of Rewrap in > > HTML composition. > > I suspect the biggest reason for Rewrap in html composition is when replying > to a plaintext message which has lines wrapped to odd lengths, like 100 > columns, and you want to send out mail where even the quote is wrapped more > reasonably. > Or consider: A sends plaintext mail wrapped to 120 columns, B replies and > quotes A but B has a line length of 60 columns. Now C replies to the mail in > mozilla, and the resulting quote is comb-wrapped. Rewrapping would fix that. Yes, that's quite what I'm getting at -- that *is* the case I think Rewrap is good for. If the messages have been properly formatted with f=f, or with HTML, then the replies should not exhibit the comb-effect and should be displayed as reflowing proportional text, and therefore shouldn't need a Rewrap. > I can see an argument for requesting that all plaintext quotes be converted > to html type quotes when rewrapping from an html window (in the sense that > they're put inside appropriate levels of blockquote, to be wrapped > appropriately at send time) instead of rewrapping the text as plaintext. > Is that what you're asking for here? This bug isn't considering multi-level quotes, if that's what you're getting at there. Currently, the reply is initialized as expected -- the (first-level) quoted text is contained within a <blockquote>, and for non-f=f plain text, also within a <pre>. The issue is that, when Rewrap is executed, the <blockquote> is replaced with a <span> that loses reflow information when the window is resized, and that adds gratuitous ">" characters to maintain the appearance of quoting. Another thing I've just noticed is that using Rewrap throws away any formatting or images or practically anything else in quoted text. Maybe Rewrap is simply not suitable for HTML, period; but it would be occasionally useful for the case cited above -- plain text within a <pre> block (or, I suppose, a white-space:pre span). What would be *best* would be, e.g., to quote non-f=f plain text in <blockquote class="-moz-quoted-plain-text"> and have the default style for that class include "white-space:pre". Then, allow Rewrap under HTML to execute ONLY on such blocks. And in this case, rewrapping would simply mean that the block has its style removed; it wouldn't be necessary to reflow the source lines except for normal line-length reasons. Any lost line breaks that were desired would be re-entered by hand (introducing a <br>). This would prevent the loss of flow information, formatting, etc from any other portion of the quoted message.
(In reply to comment #0) > Finally: I do think that the CASE 1 behavior of removing the <pre> tag is > sensible: if the text is being reflowed, obviously the <pre> formatting was > unnecessary. In fact, I think that's the only useful application of Rewrap in > HTML composition. While investigating bug 254928, it occurred to me that the <pre> blocks around text quoted in an inline-forward should also removed by Rewrap -- and in fact they are. However, if Rewrap is applied to the entire message, it strips the <table> tags from the header block. On the other hand, if the forwarded text (only) is selected, Rewrap has no effect; it is necessary to select the blank line (non-<pre> <br> tag) that appears after the headers, along with the forwarded text, in order for Rewrap to strip the <pre> tags.
(In reply to comment #2) > Another thing I've just noticed is that using Rewrap throws away any > formatting or images or practically anything else in quoted text. Bug 228315.
Product: MailNews → Core
Blocks: 182659
sorry for the spam. making bugzilla reflect reality as I'm not working on these bugs. filter on FOOBARCHEESE to remove these in bulk.
Assignee: sspitzer → nobody
QA Contact: composition
Product: Core → MailNews Core
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.