Change:
if (!this.xterm) { return; } <ins> let currentText: string = await this._clipboardService.readText(); if (!await this._shouldPasteText(currentText)) { return; } </ins> this.focus(); <del> this.xterm.raw.paste(await this._clipboardService.readText()); </del> <ins> this.xterm.raw.paste(currentText); </ins> } async pasteSelection(): Promise<void> {

Discussion:
<!-- Do Not Delete This! featurerequesttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Describe the feature you'd like. --Please implement a for the VSCode integrated terminal, similar to Windows Terminal. ! More times than I care to admit, I've accidentally pasted bad text into a VSCode integrated terminal session - often due to either the wrong panel being in focus, or fat fingering an unintended right-mouse-click at a bad place/time. VSCode workspaces have replaced 99% of my standalone terminal usage these days. Having that safety net is by far the top of my missing-features wish list. (... and I was surprised to come up empty handed when searching for an existing setting or open issue.)
I think it would be good to have an opt-in setting for this as I've accidentally pasted the wrong thing as well which could be destructive. Opening up to PRs
hi, can I work on this issue?
Hey - I haven't done any work on this yet. If you're interested, please do!
okayI will try to solve this problem :)
! How do you all feel? I think the text is a bit crowded and if we want to display the clipboard it will be even more crowded
any opinions here for how to present this warning when pasting multiple lines into the terminal? It'll probably be opt-in and ideally I think it would have a preview of the first 2 lines.
Currently I am handling this situation by making a judgment before we execute paste: But it's not easy to get to the clipboard here We can also handle it here and can easily get the clipboard: But this means that all pastes in the terminal will be detected (e.g right click behavior paste)
Not sure what the right behavior is here, does Windows Terminal show it on right click as well?

I tried it and it does prompt
Perhaps we could have three options, prompt for a brief message, prompt for the first two lines, and not prompt at all
Not sure what the right text should be, here's another example from iTerm: <img width="300" alt="CleanShot 2022-01-27 at 08 56 21 src="https://user-"I do like how simple the "confirm on delete" dialog looks with the preview: <img width="316" alt="CleanShot 2022-01-27 at 09 12 03 src="https://user-"<hrHow about something like:
Looks great , let's go with that. We could enable it by default with the don't ask me again checkbox to change the setting for you.
! Hi!, I committed the latest changes and it currently looks like this. I've only done it in the 'paste', not deal wit 'pasteSelection', which I assume has the expected behavior in general? Do we need to process both? Another small problem is that I am handling the lines by separator, and if the user's pasteboard has only two lines, but each line is very long, there will also be a lot of content displayed, e.g: ! (I guess there won't be many people writing articles in vscode and using the terminal at the same time XD
In my test it doesn't care about the current state. It should be fine (no warning) if current program can handle multi-line paste. EDIT: Tested in Windows Terminal, no warning if Paste Bracketing is on.
created