isamert / scli

a simple terminal user interface for signal messenger (using signal-cli)
GNU General Public License v3.0
432 stars 40 forks source link

Disable pasting text when input area not in focus #188

Closed mark2185 closed 1 year ago

mark2185 commented 2 years ago

Today I tried pasting a commit diff and that somehow reacted to some messages in other chats, opened up a youtube link, and froze up scli, and I probably have caused a small fire somewhere. I know it's because the terminal emulator parsed it as input.

I think I saw an issue relating to this somewhere, but I can't seem to find it.

In any case, something like :attachClipText would be great, it only needs to paste the clipboard contents directly as-is.

exquo commented 2 years ago

This happens when a text is pasted into scli, while the focus is not on the input area (e.g. on the chat history). And yes, the characters in the pasted text are interpreted as keystrokes, which can perform actions such as send reactions, etc. This can indeed be annoying, or worse.

We can check whether the focus is on the input area before allowing to paste the text. This should be possible with the 'bracketed paste mode' that is already used elsewhere in scli.