Closed Bug 124175 Opened 23 years ago Closed 21 years ago

Paste As Quotation - long lines are not wrapped

Categories

(MailNews Core :: Composition, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 20240

People

(Reporter: russ, Assigned: bugzilla)

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.8) Gecko/20020204
BuildID:    2002020403

When I copy some text with long lines to the clipboard, then select 'Paste as
Quotation' from the 'Edit' menu, the long lines are not wrapped.

Reproducible: Always
Steps to Reproduce:
1. Copy some text with long lines to the clipboard.
2. Start a new message composition.
3. Place the caret in the message body.
4. Select 'Edit' > 'Paste as Quotation'

Actual Results:  Lines are pasted, but not wrapped

Expected Results:  Lines should be wrapped, as they would appear if I had
selected 'Options' > 'Rewrap' with the new bit of text highlighted.
I'm seeing this as well on 2002031104 WinME (0.9.9 release).

I would like to add that if you paste as quotation and then type on the line
immediately after the pasted text, that line does not wrap either.

This only happens on the plain text compose window.
As per Lorenzo's comment, marking this new. I've also had the problem with lines
not wrapping, but I never spotted the pattern. I think this needs to be filed as
a new bug - Lorenzo, could you do this?
OK, not marking this new - I'm not allowed! Can someone else do it please? :-)
I don't think that is the only case in which lines don't wrap properly, but I
can't seem to nail down any of the other ones. I'll file a new bug if I do.
OK, I now have 'conconfirm' and I'm still seeing this in 2002032203. Confirmed.
Status: UNCONFIRMED → NEW
Ever confirmed: true
reassign to akkana who implemented past as quotation and most of the wrapping code.
Assignee: ducarroz → akkana
It sounds like a really bad idea to me to automatically assume that the user
wants all pasted lines rewrapped.  What if you're pasting code, or a poem, or
ascii graphics?  If you really want to rewrap, you can always do it after pasting.

Marking wontfix -- if you disagree, explain why my reasoning is wrong, and
reopen the bug.  I'm willing to listen but you'll have to explain how people who
do want to paste code or ascii graphics will be able to get around the mandatory
wrapping behavior.

Re your newly typed line not being wrapped because it's considered part of the
quote: that's bug 30763 and you have my complete sympathy on that one -- it's a
bad problem.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WONTFIX
I disagree. Paste as quotation should behave in exactly the same way as Paste.

 - Why is it that I can Paste as Quotation a line 150 characters long, and it
will stay on one line, but I can't type a line that long, or even Paste it
normally? This is inconsistent. The margin is there for a reason (user input
with a sensible default), and Paste respects it. Why is it that Paste as
Quotation ignores it?

 - What happens if I perform the typical operation of selecting and copying a
paragraph of text from a received message, and then use Paste as Quotation? If
the original paragraph is all on one line (e.g. from a webmail account), when
it's displayed Mozilla displays wraps it to fit the window, but when I copy it
and Paste as Quotation it suddenly goes back to being one line. So I'm quoting
what I think is a paragraph of text and all I get is one line that ignores the
margin. Not what I wanted.

 - What happens if I write a paragraph of text in an editor that supports word
wrap (Word, or even Notepad!) and then Paste as Quotation? As before, what I
thought was a paragraph is suddenly all on one line. Not what i wanted.

The only reason I can think of for disabling wrapping in Paste as Quotation is
to prevent things such as this:

> Blah blah blah blah blah blah blah blah blah blah blah blah 
blah blah
> blah blah blah.

but this could be fixed by changing the wrap position of Paste as Quotation by 2
characters to stop it wrapping when the extra "> " is added.

Also, you say:
> I'm willing to listen but you'll have to explain how people who
> do want to paste code or ascii graphics will be able to get around
> the mandatory wrapping behavior.

They can't *paste* code or ascii graphics, because the Paste command wraps! Only
Paste as Quotation doesn't wrap... if you're saying that this is a feature, and
that the Paste as Quotation command was added so that people could paste code or
graphics (as we have seen, they can't do that with Paste), then I would suggest
that the menu item be renamed from Paste as Quotation to Paste without Wrapping.

I'm inclined to think that this should be reopened. Reporter, what do you think?
I'm not the reporter, but I tend to agree with the previous comment.  It's
certainly most common to want to paste as a quotation flowed text, not
preformatted text.

Perhaps this can be resolved by adding a menu item "paste preformatted"?  Or,
following convention for many Windows apps, have a menu item "Paste special..."
where a variety of options are provided for pasting unformatted, quoted,
preformatted, etc.
> Paste as quotation should behave in exactly the same way as Paste.

Why shouldn't it behave the same way as quoting the original message would have?

When we auto-quote, or quote with the quote button, we don't wrap.  IMO, paste
as quotation should do the same thing as the other quote insertion devices.  If
you want paste as quotation to rewrap, then why wouldn't you also want insert as
quotation to rewrap?  I could see asking for a pref to make rewrap happen in
both of these cases, but I don't understand wanting them to be different.

The margin is there for text you type; not for quoted text.  Why would you
compose a long paragraph in an external editor and then paste it as a quotation?
 It isn't a quotation, it's original text that you wrote.

Meanwhile, it is quite common for some users to quote messages containing things
like code.  If your request were addressed, there would be no way to do that;
whereas with the current setup, it's easy for you to rewrap after inserting.
Yes, I see your points. However, Paste as Quotation _doesn't_ behave the same as
replying with regard to wrapping. For example:

1. Using mozilla, send yourself a message with a long line of text.
2. When you receive the message, Mozilla displays it on two or more lines,
although the line-breaks are not the same as the ones you see using
View->Message Source and vary if you resize the window(due to the
"format=flowed" I think).
3. Click Reply.
4. Note that mozilla quotes the message properly using the original line breaks
(the ones you would see if you did View->Message Source on the message you
received).
5. Go back to the message you received and select the message contents with the
mouse or with Edit->Select->All.
6. Press CTRL-C to copy the contents.
7. Go back to the reply you were composing.
8. Paste as Quotation.

Results: the quote created by the Reply button wraps, the quote created by Paste
as Quotation is all on one line.

I think it's pretty obvious that the user would expect some form of wrapping in
this case.

Also try this:

1. Compose a message.
2. Type a paragraph.
3. Select the paragraph, cut and then paste as quotation
4. The paragraph is now all on one line.

Does this *feel* right? It definitely doesn't to me.

Another two points:
 - I think the point that quotes should not wrap is debatable, especially since
a lot of webmail gateways and web forms don't enforce margins.

 - By saying paste as quotation should behave like quote instead of paste, you
are somehow giving precedence to the formatting of the message the user is
replying to over the user's preferences (margins and wrapping).
Also, Rewrap doesn't work too well as a workaround in this situation, because it
will ignore newlines (which, in wrapped text, indicate a new paragraph and thus
should be maintained after rewrapping) and just rewrap everything.

But perhaps that is another bug.
In your example, you didn't send a long line.  Mozilla wrapped the output of the
first message, so when you replied, you were replying to a message with normal
length lines.  To test what you were trying to test, try turning off wrapping
and format=flowed in mozilla, or use some other mailer that sends with long lines.

>  - I think the point that quotes should not wrap is debatable, especially since 
> a lot of webmail gateways and web forms don't enforce margins.

Yes, it is debatable.  I would like to see us wrap to a different line length
(perhaps the normal wrapcol plus 8 or so) but that's tricky to do in the
nsPlaintextSerializer.  I'm not sure if there's a bug currently covering that
request or not; it wouldn't hurt to file one if you care about that (cc me).
> Also, Rewrap doesn't work too well as a workaround in this situation, because it
> will ignore newlines (which, in wrapped text, indicate a new paragraph and thus

It's not supposed to ignore newlines.  If you can make a reproducible case (to
make it easier to test, preferably start with something like "paste this line as
a quotation" so it's not dependant on having a specific message in your inbox
and replying to it) you should file a bug on that, to me.
Wait, I should clarify the last remark.  When there's a single newline in the
input string, rewrap should maintain a single newline in the output.  It won't
change one newline into two, so that it looks like a paragraph break (it won't
do that on regular non-quoted paste either).
> If you can make a reproducible case (...) you should file a bug on that, to me.

Ok, I have filed bug 142953 (Rewrap ignores newlines after Paste as Quotation)
on this. Its status is Unconfirmed; please set to new if you see the problem too.
Regarding comment 13: yes, the behaviour I was observing is due to the
format=flowed specification; when replying to a message with long lines, the
quoting in the Reply command does not wrap.

The point, however, was that if I select wrapped text (e.g. a paragraph) from a
plain text message displayed in mozilla, or from a web page, or whatever, and
then use Paste as Quotation to paste it into a new message, the text appears on
one line. To me, this means that Paste as Quotation is not working properly.

For mail messages, it's due to the fact that the message has format=flowed, but
we should note that that is the default for messages sent by mozilla. But what
about pasting as quotation from a web or from Word or any other wrapped source?
My expectation is that 'Paste as quotation' behaves like normal 'Paste' with
respect to the wrapping - it appears as it would if it were quoted in a message
reply, and (IIRC, correct me if I'm wrong) if it were pasted as quotation in
HTML mode. Any other behaviour is inconsistent.

I do, however, see the point about pasting something (e.g. a code listing) which
we don't want wrapped. Therefore, I would support the addition of 'Paste
special' or similar which would allow both both normal paste and paste as
quotation *without* wrapping.

Reopening, apologies if none of the above makes sense but I'm very tired :-)
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Back to mail/news for a UI decision about whether to add a new menu item and
what to call it.  The current "paste as quotation" treats the pasted text just
like any other quotation (e.g. the same as text which is auto-quoted when
replying) -- it is named accurately.  If a new type of paste was added which
inserted "> " but also rewrapped, someone will have to come up with a name for
that behavior.

Hand the bug back to me (or fork a sub-bug) to implement the backend if we go
forward with this feature.
Assignee: akkana → ducarroz
Status: REOPENED → NEW
Re comment 12 and 14: I don't know what I was smoking when I wrote that, but of
course rewrap will eliminate single newlines in the plaintext it's rewrapping. 
So Lorenzo's point in comment 12 stands.  I agree that the paragraph being added
as all one line isn't a good thing; I don't actually understand why someone
would want to do this (if you just wrote it, it's not a quote so why mark it as
one?) but I can see wanting to paste quotations from other applications (what if
you have another mailbox in some system that mozilla can't handle, like webmail
or a proprietary system).

Really, I think wrapping quotes to a slightly wider margin than normal text,
rather than leaving them unwrapped, is probably the best solution to all of
these problems.  That might make everyone happy if we could make the output
system do it as well as making layout show it properly.
Really, I think wrapping quotes to a slightly wider margin than normal text,
rather than leaving them unwrapped, is probably the best solution to all of
these problems.

I agree that this is the best solution.

But has anyone thought of the "quote of a quote" case?

e.g.
> > > > > This was not a very long line before, but
> now it
> > > > > wraps because of all the > chars.
I totally agree with Akkana. To repeat the main reason:

You may want to paste something which *must* *not* be wrapped. So this is the
way to go. If you want it wrapped, you still can use rewrap. If you wrap it in
the first place, there is no way to go back. So "fixing" this bug (which is
actually a feature) would take away an important choice.

Suggesting WONTFIX again.

pi
Whatever wrapping is done to a normal quotation (in reply to an e-mail) is
exactly what should happen to text pasted as quotation. As I said, any other
behaviour is inconsistent, and therefore unexpected. I like Akkana's idea of
wrapping at a couple of chars wider in both cases though!

I do see the need for pasting as quotation without wrapping (or rather,
maintaining the original wrapping), although in all the cases I've used 'Paste
as Quotation' I *did* want wrapping.

To summarise, I think there's 3 things that need doing:

1) Make 'Paste as Quotation' wrap in the same way as a normal quoted message.

2) Add (a) another option 'Paste as Quotation (no rewrapping)', or (b) a
tickable menu option in the 'Edit' menu e.g. 'Rewrap when pasting' (this would
apply to both 'Paste' and 'Paste as Quotation').

3) Make both methods of quoting wrap at either (a) a couple of characters wider
than the normal text width, or (b) (if it can be done reliably) do some sort of
intelligent guessing at where to wrap based on the number of repetitions of '> '
at the start of the string.

Does this make everyone happy? :-) My favourites would be 2(b) (because there
are likely to be cases where people don't want standard 'Paste' to wrap either)
and 3(b) (because it's likely to produce a nicer result), and obviously 1, the
original subject of this bug.
> Whatever wrapping is done to a normal quotation (in reply to an e-mail)
> is exactly what should happen to text pasted as quotation.

ACK

> I do see the need for pasting as quotation without wrapping (or rather,
> maintaining the original wrapping), although in all the cases I've used
> 'Paste as Quotation' I *did* want wrapping.

Right, there must be the option. And there is right now.

> 1) Make 'Paste as Quotation' wrap in the same way as a normal quoted message.

Which means: WONTFIX:-))

> 2) Add (a) another option 'Paste as Quotation (no rewrapping)', or
> (b) a tickable menu option in the 'Edit' menu e.g. 'Rewrap when pasting'
> (this would apply to both 'Paste' and 'Paste as Quotation').

a) does not work because of the first argument that both ways of quoting shall
agree. b) sounds reasonable.

> 3) Make both methods of quoting wrap at either (a) a couple of characters
> wider than the normal text width, or (b) (if it can be done reliably) do
> some sort of intelligent guessing at where to wrap based on the number of
> repetitions of '> ' at the start of the string.

Actually, this is what Eudora does, and it fails. Whatever the value of a) is,
it will not fit for many messages. I have no clue how b) should work.

pi
QA Contact: sheelar → esther
> Right, there must be the option. And there is right now.

Yes, but it's a workaround and not particularly intuitive. There's no reason not
to do it "properly" (at some point in the future, I'm well aware that it's not
exactly a show-stopper bug!)

> > 1) Make 'Paste as Quotation' wrap in the same way as a normal quoted message.
> Which means: WONTFIX:-))

Oops, ignore me, I'm a muppet! I was under the impression that normal quotations
were wrapped, however now I've actually tried it I find that I was wrong. Ho hum.

However, the 'Paste as Quotation' behaviour is still inconsistent with standard
'Paste', and it not the desired behaviour in most cases; as such I think the bug
still stands.

> [2] b) sounds reasonable

Yes, I think that this caters for all needs. Of course, the next question is
'What should the default be - wrap or not?' :-)

> Actually, this is what Eudora does, and it fails.

Hmmm. Having thought about it, I think it's not such a great idea after all - in
the case where we're pasting an already-quoted message, we can assume that it's
already wrapped correctly (or at least reasonably), and therefore 'Paste as
Quotation' without rewrapping will be the best method.

Well, by my reckoning, that reduces down to "Add 'Rewrap when pasting' tickable
option to Edit menu in message composer". Everyone agree?

(Please note, however, that I think that this is still a 'minor' bug not an
'enhancement', since IMHO the *current* behaviour is incorrect (but has a
workaround) except in a few cases.)
QA Contact: esther → sheelar
I filed bug 144842 to track the issue of wrapping quoted text at a slightly
wider point than original text, since that's a different issue which keeps
getting mentioned but doesn't have an explicit bug to track it.
Boris, regarding your comment #22:

> If you want it wrapped, you still can use rewrap.

No, you can't.
Rewrap removes all newlines, subverting whatever structure the text had. For
example, use Paste as quotation to paste the following two lines:

This is a sentence.
This is another sentence.

and then use Rewrap. All of it is now on one line, makes rewrap useless for what
you propose. See bug #142953 for a more detailed explanation.
Lorenzo,

yes, there might be the case you describe. But bug 142953 is INVALID. Either way
there will be bad cases. But in your case you can still fix this by hand. Or you
can apply rewrap only to the area you wish to rewrap (just mark it).

pi
Yes, bug 142953 is invalid. This means that the Rewrap command performs
according to specifications.

However, Rewrap is not a workaround for this problem, because it eliminates all
newlines.

This means you can't use Rewrap to fix the problem described in this bug.
Boris, regarding your comment #24: Paste as Quotation does *not* wrap in the
same way as a normal quoted message. See my comment #11. This *is* still a bug.

Paste as Quotation should behave in the same way as reply quoting.
My *guess* is that you see the following effect:

"Normal" quoting takes lines and does not use f=f to unwrap it.

"Paste as quotation" does not know about those soft line breaks. Hence it cannot
do the same.

pi
Boris: yes, that is the problem. But I insist that _this is a bug_.

If I copy wrapped text from a message and then Paste as Quotation, and the text
appears on one line and goes off the screen, that is definitely a bug.

If I copy wrapped text from a text file and then Paste as Quotation, and the
text appears on one line and goes of the screen, that is also a bug.

To summarize, _there is no way_ to paste a wrapped paragraph as quotation
without having to reflow it manually; and at that point, you might as well Paste
it and add the quoting marks yourself...

This is a bug, and there is no workaround. You can't use Rewrap as a workaround,
because Rewrap eats all newlines and removes paragraphs from wrapped text,
changing the structure of what you intended to paste.

Some say that Paste as Quotation must not do anything to line breaks, because it
is common to paste code or ascii art as quotation. Ok, but which is more common,
pasting a line of code or a paragraph? Which will users do more frequently? I
say  the paragraph.

Discussion on how to make the command work for everbody has failed to find a
soulution, as seen in bug 144842. So if there is no way to fix it, then let's
split the command in two menu items. They could be Paste as Quotation and Paste
as Code, or Paste as Quotation and Paste as Quotation (wrapped), or whatever: I
am no UI expert.

But I insist that the "paste a wrapped paragraph" case must have a solution.
OK, lets figure out what all of us are actually talking about.

> Boris: yes, that is the problem. But I insist that _this is a bug_.

Against which standard?

> If I copy wrapped text from a message and then Paste as Quotation, and
> the text appears on one line and goes off the screen, that is
> definitely a bug.

There are two solutions to this problem:
1) Actually wrap the lines.
2) Virtually wrap the lines at the end of the screen while displaying.

I would go for 2).

> You can't use Rewrap as a workaround, because Rewrap eats all newlines
> and removes paragraphs from wrapped text, changing the structure of
> what you intended to paste.

Changing the structure is the main problem, no matter which way we want to go.
In your case you still can use rewrap if you mark the paragraph you want to
rewrap. You don't have to rewrap the whole message.

> Some say that Paste as Quotation must not do anything to line breaks,
> because it is common to paste code or ascii art as quotation. Ok, but
> which is more common, pasting a line of code or a paragraph? Which
> will users do more frequently? I say  the paragraph.

Either way there must be a way to handle the situation.

> Discussion on how to make the command work for everbody has failed to
> find a soulution, as seen in bug 144842. So if there is no way to fix
> it, then let's split the command in two menu items. They could be
> Paste as Quotation and Paste as Code, or Paste as Quotation and Paste
> as Quotation (wrapped), or whatever: I am no UI expert.

That would be an option. If that is the decision there must be an option how to
handle normal quotes.

pi
Boris: it's a bug because it's unexpected behaviour.

Or do you suggest that a user copying wrapped text from a message and pasting it
as quotation _expects_ it to go all on one line?

> You still can use rewrap if you mark the paragraph you want to rewrap.

So you think it's reasonable to have to select and Rewrap all the paragraphs one
at a time? It doesn't seem reasonable to me.

I think current behaviour is broken in the "paste a wrapped paragraph" case
(comment #32), which is probably the most frequent use of this function by the
average user.
Other people following this bug: since we can't seem to settle the argument on
how Paste as Quotation should work, what about adding a new menu item as suggested?
> Or do you suggest that a user copying wrapped text
> from a message and pasting it as quotation _expects_
> it to go all on one line?

Please be more specific. If text is really wrapped I would expect "n lines in n
lines out". But if it is one line only virtually wrapped at screen border, then
I'd expect one quoted line.

>> You still can use rewrap if you mark the paragraph you want to rewrap.
>
> So you think it's reasonable to have to select and Rewrap all
> the paragraphs one at a time? It doesn't seem reasonable to me.

Since I only see rare case (though agreeing they exist) where rewrapping leads
to problems, I think this is OK. Having rewrap more accessible (e.g. with a
button) would make this easier.

> I think current behaviour is broken in the "paste a wrapped paragraph"
> case (comment #32), which is probably the most frequent use of this
> function by the average user.

My suggestion to this bug is to add this as new function.

pi
Actually, this bug here is the same as bug 20240. That bug refers to quoting
upon reply, this bug refers to adding quotes, but the underlying mechanism is
the same. Why should those be treated diffently? Mark as dupe?

pi
Yes, bug 20240 is about the same problem. That bug was marked invalid in
december 1999 because 4.x exhibits the same behaviour as Mozilla. However, I
think that it's time to reconsider that choice now that Mozilla is not in 4.x's
shadow any more.

If we dupe this bug to bug 20420, we won't have any open bug on this issue,
which exists and should be fixed. So if you want to dupe it to bug 20420 then
perhaps bug 20420 should be reopened.
Bug 196033 covers the suggestion to wrap quoted text.

Therefore, marking as dupe.

pi

*** This bug has been marked as a duplicate of 20420 ***
Status: NEW → RESOLVED
Closed: 22 years ago21 years ago
Resolution: --- → DUPLICATE
This bug is not a duplicate of bug 20420.  Based on comment 38,
I think this bug is a duplicate of bug 20240.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---

*** This bug has been marked as a duplicate of 20240 ***
Status: REOPENED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → DUPLICATE
v
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.