Why does xclip-copied text pasted into Gmail on Firefox turn line breaks into spaces?
6
votes
2
answers
593
views
I have a text editor I made that uses xclip to copy text. I notice that when I paste the xclip-copied text (pasting the regular way, with ctrl+v) into a Gmail email on Firefox 54.0 (64-bit) that I'm composing, it replaces all of the line breaks with spaces (and if there are multiple line breaks in a row, it turns all of them collectively into a single space). When I paste it elsewhere, I don't have this issue. However, when I copy from somewhere like Leafpad and paste it into a Gmail email in Firefox, it retains the line breaks. The same problem doesn't happen with Gmail in the Chromium web browser.
Why does this happen, and is there a way to fix it so it doesn't strip out the line breaks?
I'm using xclip 0.12 on Xubuntu 16.10, 64-bit. Here's the command I use to copy the text:
xclip -selection clipboard [seeBelow]
I use this line of Python code to insert the text where I have [seeBelow] above:
subprocess.Popen(command, stdin=subprocess.PIPE).communicate(text.encode());
I am copying the text from a Python3 Tkinter multi-line Text widget (well, a widget that inherits Text, and should be practically the same for our purposes).
The problem just seems to happen in Gmail within Firefox. That is a place I frequently like to paste, however, as I often write my emails in my editor.
Asked by Brōtsyorfuzthrāx
(297 rep)
Aug 5, 2017, 08:08 AM
Last activity: Aug 6, 2023, 11:07 AM
Last activity: Aug 6, 2023, 11:07 AM