X
Tap here to go to the mobile version of the site.

Support Forum

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

Posted

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?

Modified by ncksta

Chosen solution

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/

Read this answer in context 0

Additional System Details

Installed Plug-ins

  • Provides information about the default web browser
  • Displays Java applet content, or a placeholder if Java is not installed.
  • The QuickTime Plugin allows you to view a wide variety of multimedia content in web pages. For more information, visit the QuickTime Web site.
  • Shockwave Flash 12.0 r0
  • A plugin to detect whether the Adobe Extension Manager is installed on this machine.
  • Adobe® Acrobat® Plug-in for Web Browsers, Version 10.1.9
  • Adobe Shockwave for Director Netscape plug-in, version 12.0.7
  • Microsoft Office for Mac SharePoint Browser Plug-in
  • iPhoto6
  • The Flip4Mac WMV Plugin allows you to view Windows Media content using QuickTime.
  • 5.1.10411.0
  • Office Live Update v1.0

Application

  • User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0

More Information

jscher2000
  • Top 10 Contributor
8024 solutions 65570 answers

Helpful Reply

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: Troubleshoot Firefox issues using Safe 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?

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: [[Troubleshoot Firefox issues using Safe 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?

Question owner

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.

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.

Modified by ncksta

Question owner

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.

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.
cor-el
  • Top 10 Contributor
  • Moderator
16790 solutions 151736 answers

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.

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.
jscher2000
  • Top 10 Contributor
8024 solutions 65570 answers

Chosen Solution

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/

I see now. Floating the &lt;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 (&lt;textarea>) like this one. When you paste into a single line control like a regular textbox (&lt;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: &lt;div class="float-left" style="width: 200px;">U-ID: &lt;/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/

Question owner

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?

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?

Modified by ncksta

jscher2000
  • Top 10 Contributor
8024 solutions 65570 answers

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

The two standard options for applying custom style rules to web pages are: * userContent.css file, a settings file you can create that Firefox reads at startup. See: http://kb.mozillazine.org/UserContent.css * Stylish extension, an add-on which allows you to more quickly preview the effects of rules as you write them. See: https://addons.mozilla.org/firefox/addon/stylish/