microsoft / microsoft/terminal
Allow config so that a right-click paste emits a ctrl+v (or other user defined key sequence) instead
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
# Description of the new feature/enhancement
Per https://github.com/PowerShell/PSReadLine/issues/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:
```powershell
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.
Contributor guide
Research direction
Start by tracing Windows Terminal's right-click handling and its configurable key-binding path; the issue does not name specific files or tests. Reproduce the behavior with PowerShell and PSReadLine using a multiline clipboard script, then verify that right-click produces the configured sequence and that the shell handles the paste.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, powershell
- Domain
- cli, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100