Copy adding extra space at beginning when double clicking to select text
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:
この回答をすべて読む 👍 0すべての返信 (7)
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?
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 により
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.
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 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:
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 により
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/