Mozilla VPN is currently experiencing an outage. Our team is actively working to resolve the issue. Please check the status page for real-time updates. Thank you for your patience.

Шукати в статтях підтримки

Остерігайтеся нападів зловмисників. Mozilla ніколи не просить вас зателефонувати, надіслати номер телефону у повідомленні або поділитися з кимось особистими даними. Будь ласка, повідомте про підозрілі дії за допомогою меню “Повідомити про зловживання”

Докладніше

Ця тема перенесена в архів. Якщо вам потрібна допомога, запитайте.

Copy/paste add extra space

more options

Hi, When I copy and paste text from the web, a white space is always added to the beginning of the pasted text. What is the reason?

Hi, When I copy and paste text from the web, a white space is always added to the beginning of the pasted text. What is the reason?

Усі відповіді (12)

more options

I think that will vary based on what you are copying from and how you selected it.

For example, I notice sometimes when I copy text from a table that Firefox will include the table cell boundary. In MS Word this shows up as a tab character, and when pasting into a web form, it may show up as a space.

When copying text, I find the most precise way to select to be:

  • To select a paragraph, triple-click.
  • To select more than a paragraph, select the first paragraph, then Shift+click at the end of the range I want to select.
  • To select less than a paragraph, double-click the first word, then Shift+click at the end of the range I want to select.

Not sure whether that will work for the page you're copying from.

more options

My problem is the double click. When i double click, copy and paste, the extra space appear

more options

I use an add-on that copies only plain text.

Go to the Mozilla Add-ons Web Page {web Link} (There’s a lot of good stuff here) and search for what you want.

more options

mauroponcia said

My problem is the double click. When i double click, copy and paste, the extra space appear

I don't know whether it would help to change this setting, since I think it only refers to the space after a word you double-clicked, but you could try it:

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

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

(3) Double-click the layout.word_select.eat_space_to_next_word preference to switch the value from true to false

Does that make any difference?

more options

FredMcD said

I use an add-on that copies only plain text. Go to the Mozilla Add-ons Web Page {web Link} (There’s a lot of good stuff here) and search for what you want.


Yes, there is a lot of stuff. Which one do you use?

Змінено mauroponcia

more options

jscher2000 said

mauroponcia said
My problem is the double click. When i double click, copy and paste, the extra space appear

I don't know whether it would help to change this setting, since I think it only refers to the space after a word you double-clicked, but you could try it:

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

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

(3) Double-click the layout.word_select.eat_space_to_next_word preference to switch the value from true to false

Does that make any difference?

Nothing has changed

more options

FredMcD said

I use an add-on that copies only plain text.

mauroponcia said

Yes, there is a lot of stuff. Which one do you use?

Copy As Plain Text Not compatible with Firefox Quantum

more options

Yesterday I double-clicked something and I could see that in addition to the word, something to the left of it was selected. However, I've lost track of what site that was. Can you post some examples as you come across them? What I think might be interesting is to right-click > View Selection Source to see what Firefox is including as part of the "word" in that case. (The source code should show the corresponding selection in the underlying HTML.)

more options

jscher2000 said

Yesterday I double-clicked something and I could see that in addition to the word, something to the left of it was selected. However, I've lost track of what site that was. Can you post some examples as you come across them? What I think might be interesting is to right-click > View Selection Source to see what Firefox is including as part of the "word" in that case. (The source code should show the corresponding selection in the underlying HTML.)

This is a double click. As you can see it select space in the left . This problem does not happen anywhere. Sometimes it seems there are some texts that firefox does not like. I use Firefox Quantum

Змінено mauroponcia

more options

Hi mauroponcia, thank you for that example. Because browsers ignore extra blank space, tabs, and line breaks when displaying text on screen, developers can be a little careless about the HTML.

I don't know off the top of my head how to exclude that extra whitespace from the "word" selection using any built-in features. Hopefully someone else will have an idea for that, or know of a convenient add-on that works in current releases.

more options

I don't know.. With Chrome I've never seen this problem/bug. I Will wait for an extension

more options

When I look in the bug tracking system, there seem to be a few old issues related to selecting space(s) or even the word prior to the word you double-clicked, depending on the structure of the page.

I think what might help is a script that "normalizes" the white space in that part of the page (in the <li>) by collapsing tabs and line breaks and spaces down to a single space. For example:

var tnli = document.evaluate('.//text()[(ancestor::li)]', 
  document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 
for (var i=0, len=tnli.snapshotLength; i<len; i++){
  var tn=tnli.snapshotItem(i); 
  tn.nodeValue = tn.nodeValue.replace(/\s+/g, ' ');
}

You can install the script as a bookmarklet, on your Bookmarks Toolbar or Bookmarks Menu, and run it from there. I added it to my page here:

https://www.jeffersonscher.com/res/sumomarklets.html#normli

You'll need to click the button after loading the page and before the first time you double-click to select. If the page auto-loads more results, you'll need to click the button it again. There probably are ways to make it more convenient depending on how you use the site.

If you try it out, let me know how it works for you.