Closed Bug 1611442 Opened 4 years ago Closed 4 years ago

Magic copy doesn't copy across HTML tags

Categories

(Chat Core :: General, defect)

defect
Not set
normal

Tracking

(thunderbird78+ fixed)

RESOLVED FIXED
Instantbird 79
Tracking Status
thunderbird78 + fixed

People

(Reporter: clokep, Assigned: mkmelin)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file, 2 obsolete files)

It seems that magic copy got broken at some point.

Steps to reproduce:

  1. Join IRC
  2. Have someone ping you: "clokep: Hi!"
  3. Reply to them "Hi friend!"
  4. Highlight the whole conversation and hit Ctrl+C

Expected result:

My clipboard has something like:

6:39:18 AM - friend: Hi clokep!
6:41:17 AM - clokep: Hi friend!

Actual result:

My clipboard has something like:

6:39:18 AM - friend: Hi

Additional information

It seems that everything works OK if the ping is at the start of the message, but anywhere else it stops the copying.

From a bit of experimenting (and a hint from florian) it seems that the copying breaks when it hits an HTML tag (e.g. a link or bold text).

Summary: Magic copy doesn't copy across pings sometimes → Magic copy doesn't copy across HTML tags

Sadly that makes TB unusable, since copying blocks of chat content is a frequent operation. Can't do without.

Thanks, Alice, another regression from bug 1570954. Should be fixable by a simple reversion.

EDIT: Likely some of this needs to be reversed:
https://hg.mozilla.org/comm-central/diff/a128f9557e9db7951a9d8d6467e553fdccb8a0f5/chat/modules/imThemes.jsm

Yay to mass changes without testing :-(

Flags: needinfo?(mkmelin+mozilla)
Regressed by: 1570954
Attached patch 1611442-chat-copy.patch (obsolete) — Splinter Review

This works. I did a trial and error job reverting the said changeset hunk by hunk. Let me know if your want the comment adjusted or adjust it yourself before landing.

Assignee: nobody → jorgk-bmo
Flags: needinfo?(mkmelin+mozilla)
Attachment #9157221 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9157221 [details] [diff] [review]
1611442-chat-copy.patch

Review of attachment 9157221 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for figuring this out!

::: chat/modules/imThemes.jsm
@@ +945,5 @@
>        this._otherSelected = true;
>        return;
>      }
>      let startPoint = this._range.comparePoint(spanNode, 0);
> +    // Note that we're dealing with XUL elements here, so we need to use

Can you replace "we're dealing with XUL elements here" with "we are working on the HTML DOM, including text nodes"?

This code has never dealt with XUL elements; it's actually because it was already expecting HTML that the patch doing a mass XUL->HTML conversion broke it.
Attachment #9157221 - Flags: review?(mkmelin+mozilla) → review?

(In reply to Jorg K (CEST = GMT+2) from comment #5)

EDIT: Likely some of this needs to be reversed:
https://hg.mozilla.org/comm-central/diff/a128f9557e9db7951a9d8d6467e553fdccb8a0f5/chat/modules/imThemes.jsm

Should we actually revert all the changes to this file? I haven't looked in details to guess the impact of the changes, but none of this code was touching XUL. Some is HTML and some is XML (.plist files).

Attached patch 1611442-chat-copy.patch (obsolete) — Splinter Review

Comment adjusted. I refer the other question to Magnus. I don't want to be the assignee here, I'm just mopping up :-(

Attachment #9157221 - Attachment is obsolete: true
Attachment #9157221 - Flags: review?
Attachment #9157229 - Flags: review?(mkmelin+mozilla)
Assignee: jorgk-bmo → nobody
Comment on attachment 9157229 [details] [diff] [review]
1611442-chat-copy.patch

Review of attachment 9157229 [details] [diff] [review]:
-----------------------------------------------------------------

It doesn't look like any of the other changes were wrong.

::: chat/modules/imThemes.jsm
@@ +946,5 @@
>        return;
>      }
>      let startPoint = this._range.comparePoint(spanNode, 0);
> +    // Note that we are working on the HTML DOM, including text nodes,
> +    // so we need to use childNodes() here and below.

childNodes, not childNodes()
Attachment #9157229 - Flags: review?(mkmelin+mozilla) → review+
Assignee: nobody → mkmelin+mozilla
Attachment #9157229 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #9157611 - Flags: review+
Target Milestone: --- → Instantbird 79
Comment on attachment 9157611 [details] [diff] [review]
1611442-chat-copy.patch

[Approval Request Comment]
Regression caused by (bug #): 1570954
User impact if declined: I find chat unusable if you can't copy/paste.
Attachment #9157611 - Flags: approval-comm-beta?
Comment on attachment 9157611 [details] [diff] [review]
1611442-chat-copy.patch

Approved for beta
Attachment #9157611 - Flags: approval-comm-beta? → approval-comm-beta+

Pushed by thunderbird@calypsoblue.org:
https://hg.mozilla.org/comm-central/rev/c2c86d40d2a6
Revert part of bug 1570954 (rev. a128f9557e9d) to fix copying from chat conversations. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: