Bug 462436 - On Ctrl+Shift+V it often inserts "![[~200~" before and "~" after the inserted command
Summary: On Ctrl+Shift+V it often inserts "![[~200~" before and "~" after the inserted...
Status: RESOLVED NOT A BUG
Alias: None
Product: konsole
Classification: Applications
Component: copy-paste (show other bugs)
Version: 22.08.3
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-30 12:37 UTC by Henning
Modified: 2023-12-19 04:34 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henning 2022-11-30 12:37:02 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. copy something
2. insert it in console with Ctrl+Shift+V
3. repeat couple of times

OBSERVED RESULT
reproduceable on various distros, Fedora or Ubuntu based. Konsole inserts that weird symbols before and after the inserted command. Happening in ~20% of pastes.

EXPECTED RESULT
normal pasting

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 37
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Kernel Version: 6.0.10-300.fc37.x86_64 (64-bit)
Graphics Platform: Wayland
Comment 1 ninjalj 2022-11-30 21:30:30 UTC
This corresponds to "bracketed paste", which is a protocol between applications (including shells) and terminal emulators that allows applications to distinguish pasted text from text typed by the user.  

See:

https://superuser.com/questions/1532688/pasting-required-text-into-terminal-emulator-results-in-200required-text

If you are seeing the ESC[200~ and ~ parts, it could be that the terminal emulator and the application are getting different ideas of whether bracketed paste is enabled (e.g. if an editor that sets bracketed paste mode crashes without unsetting it), or maybe, as the superuser post above suggests, Ctrl+V is getting registered before the paste, which shells usually interpret as a request to insert the following input literally.
Comment 2 fanzhuyifan 2023-12-17 06:37:31 UTC
Cannot reproduce. Could you verify if you are accidentally pressing just Ctrl V before the paste?
Comment 3 Henning 2023-12-19 03:29:07 UTC
I can sometimes reproduce this but not often. I dont know when this happens but it still did.

I dont know what "pressing Ctrl+V before pasting" means, as Ctrl+V should paste

I could not reproduce this when pressing "Ctrl+Shift+V" or "Ctrl+V" on Fokus timer, and then pasting into Konsole. But I had this issue some days ago
Comment 4 fanzhuyifan 2023-12-19 04:34:19 UTC
(In reply to Henning from comment #3)
> I can sometimes reproduce this but not often. I dont know when this happens
> but it still did.
> 
> I dont know what "pressing Ctrl+V before pasting" means, as Ctrl+V should
> paste
> 
> I could not reproduce this when pressing "Ctrl+Shift+V" or "Ctrl+V" on Fokus
> timer, and then pasting into Konsole. But I had this issue some days ago

Well in your original report you mentioned that you were using Ctrl+Shift+V to paste. Ctrl+V does not always mean paste.
For example, if you are using bash, this means verbatim insert [0]. Hence, if you are using bash, and you first press Ctrl+V, and then press Ctrl+Shift+V, you will see "![[~200~" before and "~" after the inserted command. And this is intended behavior of bash.

So I am closing this as not a bug, since the mentioned behavior seems to be intended behavior of bash.

[0] https://superuser.com/questions/421463/why-does-ctrl-v-not-paste-in-bash-linux-shell