2

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?

xhienne
  • 5,738
  • 1
  • 15
  • 34
user2141046
  • 862
  • 2
  • 7
  • 21

1 Answers1

0

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.

Community
  • 1
  • 1
Laur Ivan
  • 4,117
  • 3
  • 38
  • 62
  • so, basically what you're saying is I'm screwed and will never be able to copy wrapped lines from my terminal? (must use this terminal type due to work constraints) – user2141046 Mar 02 '17 at 14:01
  • AFAIK yes. You can use `-S` command, copy chunks and scroll to build the long line, but that's the same as rebuilding the wrapped line. You can also use [this approach](http://stackoverflow.com/questions/26626910/copy-specific-line-from-less) – Laur Ivan Mar 02 '17 at 14:33