Search code examples
word-wraptcshless-unix

copy less wrapped line results in broken lines


In my less (and also vi, for all that matters), when I try copy a wrapped line by marking it with the mouse, only the part of the line where I double click is copied, e.g.

lets say that this
is a a very long line
wrapped 3 times

So trying to copy the entire line results in either 'lets say that this', 'is a a very long line' or 'wrapped 3 times'.
When marking the 3 lines together and copying them will result with 3 different lines with line breaks between them (so copy to shell is a big no-no).
The problem doesn't occur when opening files with emacs and I couldn't find anything in the less man pages to stop it.

Any idea how to make the less give me the entire wrapped line when copying?


Solution

  • The terminal normally doesn't know you have a wrapped line. Performing a copy with the mouse will result in a rectangular area being selected (a number of lines and columns of characters).That being said, different implementation of terminals might "know" you've got a wrapped line.