Tilix multiline selection copy, then wl-paste produces CRLF

I thought I had left CRLF behind for unix eol when I got a libremv4 with pureos preinstalled.
Did this change with a recent update?. I think I would have noticed ^M at the end of
lines copied into emacs before, as I do now.

I’d like to configure tilix so that when I select text displayed by tilix
and copy it, it will have unix line-endings of ‘\n’ with no ‘\r’ when I wl-paste it.

Example: I did this in a tilix terminal with bash, and I am preparing this in emacs
so I did Esc 1 Esc ! wl-paste to get the following.

15:03 ~/bs]$ echo;echo test line;echo^M
test line^M
[15:03 ~/bs]$ wl-paste^M
test line^M
[15:04 ~/bs]$ wl-paste|od -a^M
0000000 t e s t sp l i n e cr nl nl^M
[15:04 ~/bs]$ ^M

Now I will copy this page from emacs -nw to the clipboard and then paste it
for this post.

which looks ok, but may have CRLF for the web textarea, I suppose.

Long for the days of teletype, when the standard was TWO carriage returns and a line feed.

Sometimes the mechanism would stick on the first carriage return, the second one would help it move to the left.

1 Like

The topic of Linux clipboards is a deep, dark rabbit-hole that leads into a maze of twisty little passages. Few humans re-emerge with their sanity intact.
After adding the necessary spaces to the code you posted
(“echo; echo test line; echo ^M” instead of “echo;echo test line;echo^M”),
and playing around with copying and pasting, here’s what I could figure out:

  1. either wl-paste inserts 0D (CR) on front of every 0A (LF) it finds, or
  2. “Text edit” (AKA gedit), emacs, and vi all strip out 0D (CR)
    #1 seems more likely, since Linux and other Unix-flavored operating systems normally use LF alone by default, so this is what Tilix probably uses internally, not CRLF.

If you don’t want CRLF (internet protocols and Windows require CRLF), you can pipe the output of wl-paste into tr, as follows:
wl-paste | tr -d ‘\r’
Edit: I read the wl-paste documentation, and discovered that wl-paste has an option to override insertion of CR. Try any of the following:
wl-paste -t UTF8_STRING
wl-paste -t STRING
wl-paste -t TEXT