Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
line breaks using less
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1546

PostPosted: Wed Jan 04, 2017 9:47 am    Post subject: line breaks using less Reply with quote

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
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6319
Location: /usr/lib64/lv2

PostPosted: Tue Jan 17, 2017 7:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7328
Location: Saint Amant, Acadiana

PostPosted: Tue Jan 17, 2017 8:07 pm    Post subject: Reply with quote

I think it is more konsole issue than less. Do you have same problem with other terminal emulators?
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Tue Jan 17, 2017 8:17 pm    Post subject: Re: line breaks using less Reply with quote

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
View user's profile Send private message
Leio
Developer
Developer


Joined: 27 Feb 2003
Posts: 487
Location: Estonia

PostPosted: Wed Jan 18, 2017 1:31 am    Post subject: Reply with quote

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
View user's profile Send private message
desultory
Administrator
Administrator


Joined: 04 Nov 2005
Posts: 9290

PostPosted: Mon Jan 23, 2017 5:19 am    Post subject: Reply with quote

Split off some posts that strayed off topic.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
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