This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Prevent paste clipboard functionality to send \n

0

Votes
0
0
Tags: klipper, clipboard klipper, clipboard klipper, clipboard
(comma "," separated)
nsolf
Registered Member
Posts
8
Karma
0
Sometimes you want to paste some text on the console or a chat window but you didn't know that it has an enter \n inside on it and it caused alot of trouble because you wanted to edit first.

Solutions:
- Popup a notification about \n inside the clipboard when you want to paste
- Let user to choose to filter \n or not and paste
- Let user to edit the clipboard (I think Klipper actually lets you do this)
nsolf
Registered Member
Posts
8
Karma
0
Even better if the user have the chance to modify and add its own blacklist of text, words, characters, etc
User avatar
google01103
Manager
Posts
6668
Karma
25
can you not do this yourself with the "add actions" option


OpenSuse Leap 42.1 x64, Plasma 5.x

nsolf
Registered Member
Posts
8
Karma
0
if I understand this right, I can add an acction to trigger whan clipboard has an \n and execute an app that can popup the notification and do the replacement of the clipboard content or not.

Well, I was thinking in an improvement in the UX, so this mean having this functionality out of the box with KDE
luebking
Karma
0
@Bill
He wants to fixup
Code: Select all
#rm -rf ~/*\n~

which he probably copied from some webpage which "accidentally" injected a linebreak (for rendering)
to
Code: Select all
#rm -rf ~/*~


if I understand this right, I can add an action to trigger when clipboard has an \n and execute an app that can popup the notification and do the replacement of the clipboard content or not.


Semi (you don't have to execute some app for the popup, that's built in) - however this behavior was seriously no UX improvement at all. On the contrary.
Do you really always want a popup everytime when you select some text that contains a newline?

Regardless of whether what you want to do is reasonable - how you want to do it is wrong (and unlikely what you originally wanted)

Background:
-----------------
a) klipper "only" manages the primary and secondary selection buffer ("the mouse and keyboard clipboards")
b) when something enters the buffer, the actions allow you to automatically perform some action on it - this would allow to eg. strip all selections from \n by eg. piping it through sed, but the intention is to prevent accidental command entering, ie. stripping only when pasting to a shell.
c) klipper has no control on what happens w/ the buffer when it's read by the client (konsole)
d) klipper is not mandatory - it's nice to have, but you can kill/suspend/block it for konsole and paste your newline entering clipboard into konsole

=> iff this was to be done at all, it would have to be done by the client.
The konsole part needed to detect the newline and offer to strip it or transfer it into a "dead" CRLF (as if you had entered Alt+Enter)
It must be offered, as konsole may run sth. entirely else, like eg. vim, and one would be very annoyed if all stuff was suddenly pasted in a single line.


Semi OT, my 2¢:
Do not copy random stuff into an interactive shell. NEVER.
That's just dangerous.
Eg. the selection could contain a shellbomb out of non-printable characters, build an rm command and whatnot.
If you're not absolutely sure what you copied: don't paste it into an interactive shell. Period.
nsolf
Registered Member
Posts
8
Karma
0
luebking wrote:@Bill
=> iff this was to be done at all, it would have to be done by the client.
The konsole part needed to detect the newline and offer to strip it or transfer it into a "dead" CRLF (as if you had entered Alt+Enter)
It must be offered, as konsole may run sth. entirely else, like eg. vim, and one would be very annoyed if all stuff was suddenly pasted in a single line.

Semi OT, my 2¢:
Do not copy random stuff into an interactive shell. NEVER.
That's just dangerous.
Eg. the selection could contain a shellbomb out of non-printable characters, build an rm command and whatnot.
If you're not absolutely sure what you copied: don't paste it into an interactive shell. Period.


I like this feature to be included inside konsole. Obviously this has to be offered and also with a checkbox to not notify it again and a checkbox in the configuration to enable/disable.

I know we all have to behave with care.. but well.. we are humans, so I think it's nice to have a smart environment.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell