본 사이트는 여러분의 사용자 경험을 개선하기 위해 유지 보수를 진행하는 동안 기능이 제한됩니다. 도움말로 문제가 해결되지 않고 질문을 하고 싶다면 Twitter의 @FirefoxSupport 및 Reddit의 /r/firefox 채널을 활용하세요.

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

Copy adding extra space at beginning when double clicking to select text

more options

I have to copy/paste a certain area of text many times per day, because there are many unique identifiers for a form I fill out. I double click the line to copy it and when I paste it, there is a space at the beginning which causes unneeded headaches. It works fine in Chrome.

When I view the selection source, for some reason it's also grabbing the "</div>" tag just before the text. I believe this is the cause of the space. Any thoughts on how I can fix this?

I have to copy/paste a certain area of text many times per day, because there are many unique identifiers for a form I fill out. I double click the line to copy it and when I paste it, there is a space at the beginning which causes unneeded headaches. It works fine in Chrome. When I view the selection source, for some reason it's also grabbing the "</div>" tag just before the text. I believe this is the cause of the space. Any thoughts on how I can fix this?

글쓴이 ncksta 수정일시

선택된 해결법

I see now. Floating the <div> affects how Firefox selects a "word". It captures the suppressed line break before the word. You can see that when you paste into a multiline text box (<textarea>) like this one. When you paste into a single line control like a regular textbox (<input type=text">) the line break turns into a space.

There are several possible ways to "hack" around this. One would be to override the style rules of the page along these lines:

For tag:

<div class="float-left" style="width: 200px;">U-ID: </div>

div.float-left {
  float:none !important;
  display:inline !important;
}

I think this would give the same appearance without the problem. I don't have a way to test it in your page, but here's a demo of the change:

http://jsfiddle.net/3mbye/

문맥에 따라 이 답변을 읽어주세요 👍 0

모든 댓글 (7)

more options

I can't seem to create the result you're getting. I know that if I select a table cell boundary, I get a tab as the first character when I paste, but a closing </div> tag isn't doing anything on my made up test page.

By the way, when I double-click, Firefox selects the current word; are you sure you're double-clicking and not triple-clicking?

When I triple-click, Firefox selects the entire paragraph. In order to more closely match your scenario, I can set triple-click to select only the current line instead of the complete paragraph, as follows:

(1) In a new tab, type or paste about:config in the address bar and press Enter. Click the button promising to be careful.

(2) In the search box above the list, type or paste click and pause while the list is filtered

(3) Double-click the browser.triple_click_selects_paragraph preference to switch it from its default value of true to false.

But still no extra space at the beginning. Maybe it's a difference between MacOS and Windows?


In case one of your extensions is involved, could you test the page in Firefox's Safe Mode? That's a standard diagnostic tool to deactivate extensions and some advanced features of Firefox. More info: Diagnose Firefox issues using Troubleshoot Mode.

You can restart Firefox in Safe Mode using either:

  • "3-bar" menu button > "?" button > Restart with Add-ons Disabled
  • (menu bar) Help > Restart with Add-ons Disabled

Not all add-ons are disabled: Flash and other plugins still run

After Firefox shuts down, a small dialog should appear. Click "Start in Safe Mode" (not Reset).

Any difference?

more options

Thank you for taking the time to reply. I've tried the configuration change and verified I am only double clicking. Safe mode yields the same results. I've attached a screenshot showing the line of code I get when viewing the selection source. It copies normally if I use Inspect Element and remove the F leaving only numbers. The letter seems to throw it off.

글쓴이 ncksta 수정일시

more options

This is still quite bothersome. Anyone else know why it may be doing this? Works fine in Safari, Chrome, & even IE. Only firefox has issues.

more options

I don't think the there is much to do about this.

Does it make a difference if you start selecting right-to-left or left-to-right?

If you select right-to-left with the mouse then you can stop before the leading 'F' and possibly add the 'F' manually (Shift and cursor left) to see if that works.

more options

선택된 해결법

I see now. Floating the <div> affects how Firefox selects a "word". It captures the suppressed line break before the word. You can see that when you paste into a multiline text box (<textarea>) like this one. When you paste into a single line control like a regular textbox (<input type=text">) the line break turns into a space.

There are several possible ways to "hack" around this. One would be to override the style rules of the page along these lines:

For tag:

<div class="float-left" style="width: 200px;">U-ID: </div>

div.float-left {
  float:none !important;
  display:inline !important;
}

I think this would give the same appearance without the problem. I don't have a way to test it in your page, but here's a demo of the change:

http://jsfiddle.net/3mbye/

more options

Thanks! I really do appreciate your help on this one! I'll fiddle with it and try to override the style. Do you have any suggestions about the best way to do this?

글쓴이 ncksta 수정일시

more options

The two standard options for applying custom style rules to web pages are: