Open Bug 220575 Opened 18 years ago Updated 12 years ago

Edit|Rewrap forces hard line breaks, interferes with format=flowed wrapping

Categories

(MailNews Core :: Composition, defect)

defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: mcow, Unassigned)

References

(Blocks 2 open bugs)

Details

Compose a plaintext message with format=flowed and text wrapping set to a 
reasonable (nonzero) number:
  mailnews.send_plaintext_flowed = true
  mailnews.wraplength = 72  (e.g.)
Compose a message with a paragraph long enough to wrap.  Go into the middle of 
the paragraph and add more text: as the end of the line advances beyond the wrap 
column, the entire paragraph reflows.

Now select   Edit|Rewrap
Again type some text in the middle of a line in the paragraph: the rewrapped 
lines have been given hard line breaks, and only the line reflows as it extends 
beyond the wrap column.

The reason I select Edit|Rewrap during composition is to rewrap the quoted text 
in a reply, not the text I'm writing.  The only effect Rewrap has on the text 
being composed is to strip the f=f info -- it doesn't actually rewrap composed 
lines with hard breaks at the end, such as for several long lines of pasted 
text.  (Maybe that's another bug or RFE.)  But if I want hard breaks in my own 
text, I can type them in.  Fixing the stripped out f=f end-of-line spaces is a 
much more tedious job.

This is related to bug 155622.
The problem here is that nsPlaintextEditor::Rewrap is wrapping everything,
including the new text, to the length gotten from GetWrapWidth() (which normally
comes from a pref) before it gets passed to nsInternetCiter::Rewrap.

The editor is doing this because its save architecture is all screwed up: it
passes flags through its various save routines but it has no way to pass wrap
column, so it always falls back on calling GetWrapWidth() just before saving.

It would be better to pass a wrap column through SharedOutputString and
OutputToString, and use some special case (perhaps -1) to mean "check the pref".
 Then cases like Rewrap which don't want wrapping could pass 0 (no wrap).

A simple workaround that might work is to remove the OutputFormatted flag from
the SharedOutputString call in nsPlaintextEditor::Rewrap, but that's dangerous
because if any html gets in there (e.g. the user pastes html from an external
app into the html compose window) then calls rewrap, the html formatting may be
lost forever.  And it might not work anyway.  (My tree is in a shambles right
now so it'll need rebuilding before I can find out whether it works.)

Seth, this bug should probably be on my list, but I'm not sure whether I can
commit to fixing the editor routines right away, so if you need a quick fix you
might want to hold on to the bug for that.  If you don't have anyone who can
work on it, then send it my way.
Blocks: rewrap
Blocks: 168420
This is the dupe I meant.

*** This bug has been marked as a duplicate of 223276 ***
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Sorry, marked the wrong bug.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
OS: Windows 2000 → All
Hardware: PC → All
I suppose that if no text is selected, it should rewrap only the quoted text,
leaving new text alone.  If something is seleted, it should rewrap what's
selected be it quoted, new or a mixture.

But the main issue is that it should keep the trailing spaces at soft line-ends.
Product: MailNews → Core
Nearly 2 years of inactivity. Should this bug be reassigned?
Assignee: sspitzer → nobody
Status: REOPENED → NEW
QA Contact: esther
QA Contact: composition
Product: Core → MailNews Core
Duplicate of this bug: 450051
You need to log in before you can comment on or make changes to this bug.