Blog atrasado con gajes del oficio

Firefox Problem With Xclip

I’ve used both vim and neovim editors. The latter is just the newest implementation with out of the box pre-configurations.

As expected, whenever I was trying to use the copy paste command tool such as xclip, both vim and neovim produced the newlines on the X window system across different applications.

But when I set out to write an email on Gmail from Alphabet Inc., using a copy paste command tool such as xclip, the process was to no avail: newlines were not being displayed on Gmail’s interface.

The closest match was a 2016 Yanking to clipboard does not preserve newlines (when pasting to some applications issue that was opened but was eventually closed because the user decided to have xsel take care of the problem for him/her.

But that post raised more questions than answers.

There was a reference on that thread about seeing a post on unix.stackexchange.com: pasting-in-thunderbird-turns-line-breaks-into-spaces

After reading the link provided, I recall having come across the same post hours earlier when I was trying to find out more about the issue. A Google search with keywords including but not limited to xclip or newlines, or gmail or firefox would return as one of the first results, that specific post which appeared on the stackexchange network before any other post and more relevant results would showed up. Perhaps even those that were more important queries on the web were relegated, but I guess that’s an entirely different issue.

The answer that was accepted on the stackexchange network for that particular question did nothing to resolve the problem, and I guess it wasn’t until I came across the outstanding bugs on Firefox as I will show later, that the buried comment by a user name Volker Siegel was more relevant than I thought:

Wow. I indeed was using html. Turning this off solved the problem. What could be an explanation for that? – user2820379 Apr 28 ‘15 at 8:18

Explanation? “Thunderbird, a software that has evolved over more than a decade to follow changes in protocols and UI expectations. Under these circumstances, it is inevitable that the structure degrades - know as bit rot. In this context, it is hard to introduce a new feature in conflict with the current state, when solving the conflict is infeasible. A new UI feature like HTML editing may need to be sneaked in between rotten skeletons of old protocol layers. It will work nicely, but as a result, you will find the configuration of the new feature down between these old rotten sediments.” – Volker Siegel Apr 28 ‘15 at 15:30

I wanted to get at the reasoning behind this fiasco and whether to blame neovim or gmail for it. On vim: pasting worked under the Gmail’s interface, whereas with neovim the process just failed: newlines turned into whitespace.

The bug is one of those outstanding and hence unresolved that for years has plagued the Firefox browser and its counterpart such as Firebird:

Paste in content editable div from xclip removes newlines

Paste in contentEditable div from xclip removes newlines

The above post made a reference to Gmail ignoring newlines on Copy/Paste and the unhelpful answer of a user did nothing to pinpoint at the problem:

gmail ignoring newlines

The ludicrous implementation of \r before \n is just nonsense.

And it also does not matter whether printf was used instead or a simple echo:

 $ echo -e 'una prueba\npara ver' | xclip -sel c 

or

 $ echo $'una prueba\npara ver' | xclip -sel c 

With xsel the flags are entirely different. But this clearly showed that Firefox is still trying to catch up with it. Gmail is not the problem. If it were I’d be more than happy to denote it. One could verify it by using a different email service such as Outlook from Microsoft for example.

A quick search related to Firefox turned out many more issues than what was originally intended, such as Copying text with the style “white-space: pre;” does not preserve white space (spaces, tabs, newlines)

On the above thread, an attachment provided can also be verified with xclip. It does not work under Firefox.

Another bug 116083 is still on the database for the Indiana University.

References

Clipboard specifications from freedesktop.org