2016-05-06
A weird little Firefox glitch with cut and paste
Yesterday I wrote about Chrome's cut and paste, so to be fair today is about my long
standing little irritation with Firefox's cut and paste. Firefox
doesn't have Chrome's problem; I can cut and paste from xterm
to
it without issues. It's going the other way that there's a little
issue under what I've now determined are some odd and very limited
circumstances.
The simplest way to discuss this is to show you the minimal HTML to reproduce this issue. Here it is:
<html> <body> <div>word1 word2</div> </body> </html>
If you put this in a .html file, point Firefox at the file, double click on 'word2', and try to paste it somewhere, you will discover that Firefox has put a space in front of it (at least on X). If you take out the whitespace before 'word2' in the HTML source, the space in the paste goes away. No matter how many spaces are before 'word2', you only get one in the pasted version; however, if you put a real hard tab before word2, you get a tab instead of a space.
(You can add additional ' wordN
' lines, and they'll get spaces
before the wordN when pasted. Having only word2 is just the minimal
version.)
You might wonder how I noticed such a weird thing. The answer is that this structure is present on Wandering Thoughts entry pages, such as the one for this entry. If you look up at the breadcrumbs at the top (and at the HTML source), the name of the page is structured like this. As it happens, I do a lot of selecting the filenames of existing entries when I'm writing new entries (many of my entries refer back to other entries), so I hit this all the time.
(Ironically I would not have hit this issue if I didn't care about making the HTML generated by DWiki look neat. The breadcrumbs are autogenerated, so there's no particular reason to indent them in the HTML; it just makes the HTML look better.)
This entry is also an illustration of the use of writing entries at all. Firefox has been doing this for years and years, and for those years and years I just assumed it was something known because I never bothered to narrow down exactly when it happened. Writing this entry made me systematically investigate the issue and even narrow down a minimal reproduction so I can file a Firefox bug report. I might even get a fixed version someday.
PS: If you use Firefox on Windows or Mac, I'd be interested to know if this cut and paste issue happens on them or if it's X-specific.