Closed Bug 303582 Opened 19 years ago Closed 19 years ago

copy to clipboard adds a leading/trailing space unexpectedly

Categories

(Firefox :: General, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 303597

People

(Reporter: tony-mozilla1, Unassigned)

Details

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

If you have some text on a line, with no markup on that line, ie:
<td>
   testing1 testing2
</td>

then copying the first and last words to the clipboard may produce unexpected
results, as follows:

If you select the first word on that line by dragging the mouse over it, then a
subsequent copy-to-clipboard operation will add a leading space.

If you 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>testing1 testing2</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 testing2
</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.

*** This bug has been marked as a duplicate of 303597 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.