View previous topic :: View next topic |
Author |
Message |
curmudgeon Veteran

Joined: 08 Aug 2003 Posts: 1639
|
Posted: Wed Jan 04, 2017 9:47 am Post subject: line breaks using less |
|
|
This is occasionally frustrating only because I don't understand what is going on.
When I display a file using less (in konsole), and I copy text that word wraps, sometimes I get line breaks in the copied text, and sometimes I don't (and it is not always obvious when pasted into something like kwrite using the same width).
Is there some way of controlling this? I would rather not have line breaks inserted when they weren't there to begin with. |
|
Back to top |
|
 |
audiodef Watchman


Joined: 06 Jul 2005 Posts: 6435 Location: /usr/lib64/lv2
|
Posted: Tue Jan 17, 2017 7:38 pm Post subject: |
|
|
Maybe copy using another terminal program, like nano, with the -w switch? _________________ Gentoo Studio: A Gentoo-based, professional digital audio workstation OS. |
|
Back to top |
|
 |
Jaglover Watchman


Joined: 29 May 2005 Posts: 7799 Location: Saint Amant, Acadiana
|
|
Back to top |
|
 |
khayyam Watchman


Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Tue Jan 17, 2017 8:17 pm Post subject: Re: line breaks using less |
|
|
curmudgeon wrote: | When I display a file using less (in konsole), and I copy text that word wraps, sometimes I get line breaks in the copied text, and sometimes I don't (and it is not always obvious when pasted into something like kwrite using the same width). |
curmudgeon ... less is a pager, so if you copy you are copying the file as it is displayed, and not how the file is formatted (ie, textwidth).
curmudgeon wrote: | Is there some way of controlling this? I would rather not have line breaks inserted when they weren't there to begin with. |
They are not "inserted", they are how the text is displayed. If you don't want a formatted text then use the correct method of selecting, and pasting the text:
Code: | # echo $EDITOR
vim
# less file
v
<EDITOR is started with 'file' input>
<select text, and 'yank'>
:e file2
"*p
:wq! |
Your expectations about how this should work are tainted by the gui paradigm, and you are expecting the cli should adapt to that paradigm, but it is the other way around, the cli has the same, if not better, facilities for cut & paste, text manipulation, display, etc, and to use it you need to work with it.
best ... khay |
|
Back to top |
|
 |
Leio Developer


Joined: 27 Feb 2003 Posts: 494 Location: Estonia
|
Posted: Wed Jan 18, 2017 1:31 am Post subject: |
|
|
Copying wrapped lines from less seems to work fine for me. Triple-clicking on a line (which is supposed to do a full line/paragraph select, like doubleclick does word select) is also selecting all the visible lines that are wrapped.
If my "less" is somehow working better than yours, try just wide lines that get wrapped for display outside "less", maybe print them with "cat" and try selection then. Then you can narrow down the problem to be with your "less" or your terminal.
Proper wrapping and rewrapping and line selection is actually rather hard to do how terminal emulator display widgets usually end up as. My terminal gets this mostly right - it's gnome-terminal, but other VTE based ones (mate-terminal, xfce4-terminal, etc) likely have that too, unless using some old vte slot or doing something to break it for VTE. _________________ GNOME team lead; GStreamer; MIPS/ARM64 |
|
Back to top |
|
 |
desultory Administrator


Joined: 04 Nov 2005 Posts: 9410
|
Posted: Mon Jan 23, 2017 5:19 am Post subject: |
|
|
Split off some posts that strayed off topic. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|