Closed Bug 954331 Opened 10 years ago Closed 10 years ago

Copying text from conversations removes leading indent

Categories

(Instantbird Graveyard :: Conversation, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugzilla, Assigned: aleth)

References

Details

(Whiteboard: [wanted])

Attachments

(1 file)

*** Original post on bio 898 by Mook <mook.moz+bugs.instantbird AT gmail.com> at 2011-07-06 04:29:00 UTC ***

STR:
1. Get sent some Python code (indent is significant)
2. Attempt to copy that into a text editor somewhere

Expected results:
Properly indented code.

Actual results:
All leading indent is removed, resulting in broken code.

Additional information:

Flo poked around some earlier today; he mentioned various things, in no particular order:
- This is probably the HTML to text serializer thinger collapsing adjacent whitespace
- Using a <pre> might work things work a bit better
- Using &nbsp; might work as well, but that will totally break the code being copied
*** Original post on bio 898 at 2011-07-06 08:33:34 UTC ***

-> severity: major, as there's some dataloss (the same issue is present in the logs :-().

When putting the message text inside a <pre> tag (which we could style back to normal using CSS) instead of a <span>, the text resulting from a drag&drop is correct, but the text copied to the clipboard has no indent (so there must be an issue in the magic copy code too).
Severity: normal → major
Whiteboard: [1.2-wanted]
*** Original post on bio 898 at 2012-01-30 11:20:57 UTC ***

As much as I want to see this fixed, I don't think it will make 1.2. :(
Whiteboard: [1.2-wanted] → [wanted]
*** Original post on bio 898 at 2013-02-02 17:49:22 UTC ***

Once a fix for bug 955303 (bio 1870) ensures the leading whitespace is included in aMsg.message (and not just in aMsg.originalMessage), it becomes clearer that the issue is in fact "the HTML to text serializer thinger collapsing adjacent
whitespace", as leading whitespace of any length turns into a single space.

The nbsp idea is not crazy as "Normally &nbsp; is replaced with a space character when encoding data as plain text" (nsIDocumentEncoder.idl), but still a hack.
Depends on: 955303
Attached patch PatchSplinter Review
*** Original post on bio 898 as attmnt 2220 at 2013-02-02 19:12:00 UTC ***

This seems a simple solution, unless there are side-effects I haven't considered.

The OutputPreformatted flag means
73    * Output as though the content is preformatted
74    * (e.g. maybe it's wrapped in a PRE or PRE_WRAP style tag)
75    * Plaintext output only.
Attachment #8353983 - Flags: review?(florian)
*** Original post on bio 898 at 2013-02-05 13:40:42 UTC ***

NB Magic copy currently also collapses whitespace within messages; the patch also fixes this of course.
Comment on attachment 8353983 [details] [diff] [review]
Patch

*** Original change on bio 898 attmnt 2220 at 2013-02-18 23:11:06 UTC ***

I'm really happy that this long standing issue is getting fixed! Thank you very much.
Attachment #8353983 - Flags: review?(florian) → review+
*** Original post on bio 898 at 2013-02-19 00:07:30 UTC ***

Fixed in http://hg.instantbird.org/instantbird/rev/168d3b21ad2d

Thanks!
Assignee: nobody → aleth
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4
You need to log in before you can comment on or make changes to this bug.