LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Konsole mouse triple-click trailing newline drives me ... (https://www.linuxquestions.org/questions/linux-software-2/konsole-mouse-triple-click-trailing-newline-drives-me-4175603243/)

fluix 04-05-2017 06:18 AM

Konsole mouse triple-click trailing newline drives me ...
 
Hello there,

My problem is about usability of Konsole (a linux terminal emulator, v. 16.12.3 under gnome 3.22.3): the triple-mouse-click copy of text.

I often triple-click with mouse on a line of Konsole's output with the intend to copy it and later paste it (possibly at the command line of another Konsole).

However, there is a last newline in that copied text (which I guess is right there in the terminal's output, no dispute about that) which also gets into the copied text. In effect mouse triple-click copies into buffer the whole line PLUS a newline at the end.

Nothing wrong with that except when I later paste the text on a terminal emulator, at the command line, that last newline snickily acts as a 'press enter' and automatically sends the whole pasted text to the shell for processing it without ME hitting Enter but the paster!

I don't say this is not expected behaviour or a bug. But it can surely lead to evil exploits...

Consider copying 'rm -rf /' in order to paste it into another command line *but modify* it before pressing Enter and execute it, e.g. 'rm -rf /tmp/*.log' and Konsole's paste action hits that Enter before modification...

A scenario which can happen to a new user (and any user when dealing with complex/cryptic commands) when copy-pasting from a README file etc. (Thankfully it does not happen when triple-clicking from Firefox onto Konsole!).

I would like to know whether there is an option to remove THE LAST TRAILING NEWLINE (or other spaces) from the text via the mouse triple-click action. (There is no need to remove all newlines - that will cripple it because in that case obviously someone is copying some text like a poem or something. Just the last one).

FYI: Konsole's preferences under Mouse tab has 'Trim trailing spaces' tick-box but that does absolutely nothing either on literal trailing spaces or trailing newlines. Unless I am doing something wrong?

FYI2: iTerm on Mac OSX behaves sensibly in the sense that it does not need to be told to remove trailing newlines from copy-paste - it does it by default. I would urge Konsole's or Terminal's developers/designers to have a look at iTerm and a lot of other OSX programs which in term of human-computer-interaction are champions.

As a general suggestion: Copy-paste is crucial. We need more complexity to the logic of it. We need many levels (e.g. like the double/triple clicking) of it, each level copying a certain part of the text.

best wishes to all open-source developers and thanks for Linux (can't live or earn my bread without it!),

a.

serafean 04-05-2017 07:06 AM

Check the option in "edit current profile" -> Mouse-> "Trim trailing spaces"

I like this behaviour, because every time I see it, it reminds me of the dangers of copying commands.

fluix 04-05-2017 07:31 AM

serafean,

I ticked that box as I mentioned in my post but nothing changes.

thanks,

serafean 04-05-2017 07:33 AM

In that case : https://bugs.kde.org/

fluix 04-05-2017 07:39 AM

Some more triple-click woes
 
Once I am at it, and always in the context of Konsole,

I also have to note the inconsistent behaviour between copying (by mouse triple-click) a line from the output of 'more' and copying in exactly the same way from the output of 'head', 'cat'.

% more filename.txt

Then copying one line of text from the above command will stop at the end of the window (and not at the end of the actual line)

However, with

% cat filename.txt

triple-click on any line will copy till the end of the line (as it appears in the 'filename.txt') ignoring where the line breaks because of window width (as it should be).

Must have to do with this programs using additional newline signifiers?

This behaviour I think also happens in other terminal emulators, but can't be sure which.

Want to do good in the open-source? Fix these little daily nuances rather than inventing the new gnome behemoths and breaking our nerves with, for example, 'the terminal is ready'!!!!

a.

ondoho 04-05-2017 11:12 AM

the terminal is ready?
never seen that.

but, fwiw, this behavior is not specific to konsole; my urxvt has the same triple-click behavior: select the full line, incl. trailing newline.
...and can be changed with a commandline option and/or resource :D

fluix 04-05-2017 04:34 PM

" ...and can be changed with a commandline option and/or resource "

any pointers please? this could be the solution to my problem.



"... terminal is ready"

i guess it is 'the window is ready' (already there is a remover https://extensions.gnome.org/extensi...ation-remover/ just like with the B.Gates' enterprise).

ondoho 04-06-2017 11:50 AM

Quote:

Originally Posted by fluix (Post 5693122)
any pointers please?

we're talking about a different terminal emoulator, called rxvt-unicode, command urxvt.
Quote:

Originally Posted by man urxvt
-tcw
Change the meaning of triple-click selection with the left mouse button. Only effective
when the original (non-perl) selection code is in-use. Instead of selecting a full line
it will extend the selection to the end of the logical line only. resource
tripleclickwords.
...
tripleclickwords: boolean
Change the meaning of triple-click selection with the left mouse button. Instead of
selecting a full line it will extend the selection to the end of the logical line only;
option -tcw.

Quote:

Originally Posted by fluix (Post 5693122)
'the window is ready' (already there is a remover https://extensions.gnome.org/extensi...ation-remover/ just like with the B.Gates' enterprise).

one has to install an extension to remove a nagging notification???
quo vadis, gnome?
:rolleyes:


All times are GMT -5. The time now is 05:08 AM.