copy to clipboard adds a leading/trailing space unexpectedly
Categories
(Core :: DOM: Selection, defect, P3)
Tracking
()
People
(Reporter: tony-mozilla1, Unassigned)
References
()
Details
(Whiteboard: tpi:+)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 1) If you have a markup tag, followed by some whitespace (not including newlines), followed by some text, ie: <td> testing1</td> <td> testing2 </td> then copying text beginning with the first word to the clipboard may produce unexpected results, as follows: If you select the first word by dragging the mouse over it, then a subsequent copy-to-clipboard operation will add a leading space to the clipboard. 2) If you have some text, followed by some whitespace (including newlines!), followed by a markup tag, ie: <td>testing3 </td> <td>testing4 </td> then, if you load the page in firefox and select the last word on that line by double-clicking on it, then a subsequent copy-to-clipboard operation will add a trailing space. This seems to happen only if there is any whitespace (including newlines) between the leading or trailing markup tag and the text. If there is markup on the same line with no leading/trailing whitespace, ie: <td>testing1 testing2</td> <p>testing3 testing4</p> then everything works as expected. Reproducible: Always Steps to Reproduce: 1. Create a test.html file with the following content, ensuring to preserve the whitespace before the word "testing1": <html><table><tr> <td> testing1</td> <td> testing2 </td> <td>testing3 </td> <td>testing4 </td> </tr></table></html> 2. Open the page in firefox, and select the word "testing1" by dragging your mouse pointer over the word with the left mouse button pressed. It should be highlighted now. Assert that there is no extra whitespace visibly highlighted before or after the word. Press CTRL-C to copy to clipboard. 3. Paste the clipboard somewhere (ie: in the firebox address bar), and observe that the pasted word (excluding quotes) is actually " testing1" with a leading space. This is counter-intuitive, as the leading space was not highlighted. 4. Now select the word "testing2", this time by dragging your mouse pointer over the word with the left mouse button pressed. It should be highlighted now. Assert that there is no extra whitespace visibly highlighted before or after the word. Press CTRL-C to copy to clipboard. 5. Paste the clipboard somewhere (ie: in the firebox address bar), and observe that the pasted word (excluding quotes) is actually "testing2 " with a trailing space. This is counter-intuitive, as the trailing space was not highlighted. Actual Results: see above steps Expected Results: In both cases, I would expect that only the word "testing" is pasted, since that is what was highlighted.
Reporter | ||
Comment 1•19 years ago
|
||
*** Bug 303582 has been marked as a duplicate of this bug. ***
Reporter | ||
Comment 2•19 years ago
|
||
> Expected Results:
> In both cases, I would expect that only the word "testing" is pasted, since that
> is what was highlighted.
oops... I meant "testing1" or "testing2" should be pasted. Only the selected
word, with no surrounding whitespace, should be copied to the clipboard and
later pasted.
Reproducible with Mozilla 1.8b1, but I only get extra leading spaces (" testing1" and " testing2"). WFM with Deer Park a2 and SeaMonkey/20050727 ("testing1" and "testing2"). Related to Core bug 157379?
Reproducible with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3 This bug plagues me to death. I have noticed though when I paste the contents into a ms-dos command prompt it shows " testing1 .gtk-bookmarks testing2 .gtk-bookmarks". If I paste it into any windows application it just posts a leading space or tab.
Comment 5•14 years ago
|
||
do you see this problem also in version 3.5 or newer?
Updated•14 years ago
|
Comment 6•14 years ago
|
||
Works for me using - Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 and Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100116 Firefox/3.6 Using data:text/html,<html><table><tr><td> testing1</td><td> testing2</td><td>testing3 </td><td>testing4</td></tr></table></html>
I still have this issue with Firefox Nightly on Windows 7 64 bits (27.0a1 (2013-10-07)). The HTML is : <p> <b>clé:</b> 82484950 </p> When I double click on "82484950" the selection looks good, then I CTRL+C to copy it but when I CTRL+V to paste the text in a windows app, there is an unexpected space at the beginning.
Comment 8•9 years ago
|
||
Just noting that wlach, myself, and Treeherder sheriffs observe this behavior in https://treeherder.mozilla.org in our Log viewer. To reproduce: o open https://treeherder.mozilla.org o select any completed 'Job' (eg. 'B', 'Cpp', etc) in the right hand job table o click on the 'Log' icon in the bottom left navbar o follow steps per https://bugzilla.mozilla.org/show_bug.cgi?id=1144728#c0.
Comment 9•9 years ago
|
||
Let's reopen this.
Comment 12•8 years ago
|
||
The testcase from the dupe reproduces this for me on Windows 8.
![]() |
||
Updated•8 years ago
|
Comment 13•8 years ago
|
||
I should note: I don't think this is Windows/Win32-only. My duplicate bug 1270919 happens on Linux, for example. I wouldn't be surprised if it also duplicates on Mac OS X Firefox as well (and it's easy to test if someone wants to find out; see bug 1270919 for an extremely minimal test case).
Comment 14•8 years ago
|
||
(In reply to Chris Siebenmann from comment #13) > I should note: I don't think this is Windows/Win32-only. My duplicate > bug 1270919 happens on Linux, for example. I wouldn't be surprised if > it also duplicates on Mac OS X Firefox as well (and it's easy to test > if someone wants to find out; see bug 1270919 for an extremely minimal > test case). I concur, opening the URL: data:text/html,word1%20%20word2 and double-clicking 'word2' and pasting on OS X reproduces the issue. Jim, maybe this needs to live in Core::Selection if we don't think it's widget code that's doing this? Or serialization from HTML selection to plaintext? Not sure.
![]() |
||
Comment 15•8 years ago
|
||
Lets start by investigating the cause. I'll bump the priority up as well.
Updated•1 year ago
|
Comment 17•1 year ago
|
||
The severity field for this bug is relatively low, S3. However, the bug has 3 duplicates.
:spohl, could you consider increasing the bug severity?
For more information, please visit auto_nag documentation.
Comment 18•1 year ago
|
||
The last needinfo from me was triggered in error by recent activity on the bug. I'm clearing the needinfo since this is a very old bug and I don't know if it's still relevant.
Comment 19•1 year ago
|
||
I'm no longer able to reproduce this. Tentatively closing.
Comment 20•1 year ago
|
||
The reproduction for me is now:
<html>
<div> <span> Testing 1 »
Testing2</span></div>
</html>
If I double-click select 'Testing2' and paste it, I get a leading space. This happens for me in 106.0.1 (official Mozilla build, just installed). It's possible that the leading space in the HTML in front of 'Testing2' is important.
Comment 21•1 year ago
|
||
I'm going to assign this to a (hopefully) better component.
Description
•