Description of the new feature/enhancement
Per PowerShell/PSReadLine#579 PSReadLine (which handles the interactive experience for PowerShell) cannot tell that the text is typed or pasted and can only treat it as typed. So newlines gets the input executed which can fail if the content is a multi-line script, for example:
if ($true -eq $false)
{
'true'
}
else
{
'false'
}
In this case, PowerShell will accept the individual lines for the if clause, but since else is optional, will execute the if part and then treats else as a command which fails. However, PSReadLine can handle pasting from the clipboard as it knows the entire content of the clipboard rather than seeing it character by character.
So instead of having Ctrl+v or Ctrl+Shift+v bound to terminal paste, let the shell handle it, but have the terminal emit a ctrl+v (or whatever user binding has been defined) on right-click of the mouse.
Description of the new feature/enhancement
Per PowerShell/PSReadLine#579 PSReadLine (which handles the interactive experience for PowerShell) cannot tell that the text is typed or pasted and can only treat it as typed. So newlines gets the input executed which can fail if the content is a multi-line script, for example:
In this case, PowerShell will accept the individual lines for the
ifclause, but sinceelseis optional, will execute theifpart and then treatselseas a command which fails. However, PSReadLine can handle pasting from the clipboard as it knows the entire content of the clipboard rather than seeing it character by character.So instead of having
Ctrl+vorCtrl+Shift+vbound to terminal paste, let the shell handle it, but have the terminal emit actrl+v(or whatever user binding has been defined) on right-click of the mouse.