Wrong text put in clipboard when pasting "formatted" text with exponent

RESOLVED WORKSFORME

Status

Thunderbird
Mail Window Front End
--
minor
RESOLVED WORKSFORME
11 years ago
5 years ago

People

(Reporter: Bertrand Denoix, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070509 MultiZilla/1.8.3.2f SeaMonkey/1.1.2
Build Identifier: version 2.0.0.6 (20070728)

The TB mail window implements the traditional formatting indicators for /italics/, _underscore_, and *bold*. It also handles in the same way the exponent operator: a mail containing 2^2 is displayed with plain 2 followed by "2" in superscript (and the caret sign is not shown). All this is fine and dandy.

However, if one then selects this output, and pastes it in a plain text application (Notepad or else), it gets "22" and not "2^2". Pasting in a rich text application (MS Word, Mozilla composer), gets the right thing.

Reproducible: Always

Steps to Reproduce:
1.Send a mail to yourself with string "2^2" and open resulting mail in inbox
2.Check that the message source indeed contains "2^2"
3.Select the 2+superscript 2 which appears, and copy to clipboard
4.Paste to plain text application (text editor, console...) and notice the "22" result.
Actual Results:  
"22"

Expected Results:  
"2^2"

TB ought to put different data in the clipboard in the the "plain text" version. 

I however admit that this works OK with /italics/ and the like because the characters which causes the formatting are kept in the formatted output. But exponent formatting doesn't keep this character and that will make the copy thing a lot harder to write (unless there is a way to implement some "invisible caret", which gets copied, and then blindly pasted by the receiving application).

I'm wondering if this would warrant the removal of the exponent formatting, since this could cause loss of data?

Comment 1

10 years ago
Reproducible on trunk version 3.0a1pre (2008040204)

Updated

10 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
wfm (aka "fixed") TB 17.0.6 / winXP

When viewing plaintext msg with TB, TB displays formatting characters (like /, *, and _ ) AND real formatting HTML <sup>, <i>, <b> etc.
 
For case of 2^333, the ^ character is not removed, but made invisible by width=0, like this:
<sup class="moz-txt-sup"><span style="display:inline-block;width:0;height:0;overflow:hidden">^</span>333</sup>

When copying formatted text,
a) when pasting into text editor, this is result (everything as expected, hence wfm):

2^333            -> wfm!
/italics/
*bold*
_underline_


b) when pasting into rich text editor like M$ Word, you'll also see rich aka "real" formatting for everything except underline (which would be a separate bug). Word ignores the width=0 stuff and hence the ^ reappears, but the whole sequence of ^333 is still formatted as superscript.

2^333 
/italics/ 
*bold* 
_underline_


This is the HTML clipboard content:

Version:0.9
StartHTML:00000270
EndHTML:00000798
StartFragment:00000304
EndFragment:00000762
SourceURL:mailbox:///C:/Doks/user/Anwendungsdaten/Thunderbird/Profiles[...]
<html><body>
<!--StartFragment-->2<sup class="moz-txt-sup"><span style="display:inline-block;width:0;height:0;overflow:hidden">^</span>333</sup>
<br><i class="moz-txt-slash"><span class="moz-txt-tag">/</span>italics<span class="moz-txt-tag">/</span></i>
<br><b class="moz-txt-star"><span class="moz-txt-tag">*</span>bold<span class="moz-txt-tag">*</span></b>
<br><span class="moz-txt-underscore"><span class="moz-txt-tag">_</span>underline<span class="moz-txt-tag">_</span></span>
<br>
<!--EndFragment-->
</body>
</html>
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → WORKSFORME
Ben, just curiosity, would you know why conversion of _underline_ into HTML format is treated differently from *bold* and /italics/ ?

*bold*    -> <b class="moz-txt-star">...</b>
/italics/ -> <i class="moz-txt-slash">...</i>

but:

_underline_ -> <span class="moz-txt-underscore">...</span>

iow, why don't we convert consistently like this:

_underline_ -> <u class="moz-txt-underscore">...</u> ?
Flags: needinfo?(ben.bucksch)

Comment 4

5 years ago
Please don't use needinfo.
See http://www.bucksch.org/1/projects/mozilla/16507/ footnote
Flags: needinfo?(ben.bucksch)
You need to log in before you can comment on or make changes to this bug.