-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bracketed paste using INPUT_RECORD marks #10905
Comments
Thank you @o-sdn-o. Can you add some details on what you'd like WSL's behavior to be in that case ? We forward tty input from the Windows to the Linux side so even if a copy / paste operation is detected, key strokes still need to be sent to the Linux side |
On the WSL side, it is necessary to understand INPUT_RECORD marks and accordingly replace it with in-text marks (\e[200~ \e[201~). Optionally, WSL can remove spurious in-text marks from the inserted block if they suddenly appear there between the INPUT_RECORD marks. This approach is necessary on Windows hosts to insert immutable binary blocks from the clipboard (e.g. received via ssh) into an arbitrary console application that expects it. Since WSL doesn't expect binary data, it simply replace INPUT_RECORD marks with in-text marks. We could make this replacement on our side, but it is not known in advance who is waiting for the input. I described the problem in the following comment: PowerShell/PowerShell#20896 (comment)
You can play around with this using vtm by sshing to win<->wsl or wsl<->win (this requires vtm on both sides):
|
For a more visual example, you can create a file
and then just run PS: It is necessary to add vtm to PATH to avoid specifying the full vtm path (for both sides: vtm binary for linux and vtm.exe for windows). PS: vtm doesn’t rely on ConPTY infrastructure, so it works even on Win8. |
Related to PowerShell/PSReadLine#1471 |
We can do this on our side by checking the ENABLE_VIRTUAL_TERMINAL_INPUT flag. Sorry I didn't realize this right away. |
Since wsl reads the input stream using ReadConsoleInput, could you consider adding a support for "Bracketed Paste" marks in the INPUT_RECORD's stream. This could be done by handling boundary marks for the inserted block in the following form:
This approach greatly simplifies the task of cross-platform transferring an inserted immutable block via SSH between hosts. Both from unix to windows to unix, and from windows to unix to windows.
x-link PowerShell/PowerShell#20896
The text was updated successfully, but these errors were encountered: