I've encountered this issue on other platforms like Termux on Android or when connected over ssh, but never on Ubuntu using nano.
- I'm using Ubuntu 20.04 and GNU nano, version 4.8.
- using the dialog menu or CTRL+SHIFT+C and CTRL+SHIFT+V to paste
- I need to see the entire line of text at once, so if the line is too long for the terminal, I've always had nano set for line wrapping.
But now, when I copy a line that is wrapped, nano is pasting an extra line break where every line wrap exists instead of pasting as a single line. No matter how many times it's wrapped on my screen, it should copy as a single line and paste as a single line with no line breaks.
I'm at a loss because I didn't change anything and I don't remember having this problem with nano in the past on Ubuntu.
Here is an example of a long line with the letter j:
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
As you can see, three lines are pasted instead of one.
However if I echo
or cat
the same line and then copy the wrapped output from my terminal, it pastes as a single line.
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
Tried on both xfce4-terminal and guake. Same problem. Also, I've tried softwrap
with and without the following options:
nowrap
atblanks
hardwrap
- and even
nonewlines
for good measure
and I checked /etc/nanorc
, ~/.nanorc
, and /usr/share/nano/*.nanorc
for any conflicting configurations.
nano
does not support copying to clipboard, so if you want to copy the selected text to the clipboard in order to paste it to another application, you have to use the terminal's copy shortcut Ctrl+Shitf+C. However, since this shortcut is used to copy what is displayed in the terminal and the terminal sees the text as multiple lines (not wrapped lines), the text will get copied as multiple lines.If, on the other hand, you just want to copy the wrapped text to use it inside
nano
, then you can usenano
's shortcuts for copying and pasting the selected text, since these "understand" wrapped lines. The shortcut for copying insidenano
is Alt+6 and for pasting is Ctrl+U.Related:
man nano