Closed Bug 157379 Opened 22 years ago Closed 22 years ago

Copying Text From Page Results In Extra Spaces

Categories

(Core :: DOM: Selection, defect)

defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 82811

People

(Reporter: mozilla, Assigned: mjudge)

Details

(Keywords: topembed, Whiteboard: EDITORBASE)

STEPS TO REPRODUCE:

1) Load up the Bugzilla query page (but it happens on any page).
2) Use your mouse to select the first word from the line that reads "This is
Bugzilla:"
3) Right-click and select "Copy"
4) Paste the text into any text editor.

RESULT:
There is a leading space before "This".

EXPECTED:
Copy should only copy what is selected (no leading space).

MORE:
This doesn't happen with all text on a page. For instance, if you select the
word "Query" on the Bugzilla query page, no leading space is copied. I have not
been able to learn how to predict which text this will happen with.
Think I figured it out.

Copy picks up line breaks and spaces in the source code and adds them as spaces
into the clipboard. This is happening without selecting any line breaks or
spaces for copying.

EXAMPLE:
-----
<p>
This
</p>
-----
Result of copying "This" (in the browser, not view source) = " This "

-----
<p>This</p>
-----
Result of copying "This" = "This"

-----
<p> This</p>
-----
Result of copying "This" = " This"
Well, it gets more complicated than that (unfortunately).

Here are some more examples that I see:

-----
<p>
<code>This</code>
</p>
-----
Result = " This  " <-- two trailing spaces

There are probably endless variations with the same cause.



Summary: Copying Text From Page Sometimes Includes Leading Space → Copying Text From Page Results In Extra Spaces
I was testing that bug 78676 was fixed when I noticed that an extra space was
being copied when I only selected the "bug 75893" text in the bullet item on the
page http://mozilla.org/status/2001-05-02.html.

Sure enough, the source of the relevant part of the page is:
    <ul>
 
      <li> bug 75893 - Mac Crashes at various sites.  It ended up being
a combo box problem.</li>

The space before the "bug 75893" was *not* highlighted, yet was copied anyways.
I see the problem in Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b)
Gecko/20030117, build 2003011712. Changing OS.

It is pretty annoying to copy more than is highlighted. It also (sometimes)
happens, if you just double-click a word. And this for sure means to mark
exactly the word, no new line, no space.

pi
OS: Windows XP → All
Hardware: PC → All
Keywords: topembed
Whiteboard: EDITORBASE
dup

*** This bug has been marked as a duplicate of 82811 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
I don't see why this should be a dupe of bug 82811. This here has nothing to do
with the editor. Could you explain this, please?

pi
verify dup of ws bug
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.