-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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 in conhost #395
Comments
Funny you should ask! I've been working on this one myself, as I'd love to see it land. |
one suggestion to keep in mind (as I've seen more than one implementation forget this edge case): make sure to filter out control sequences when pasting. otherwise the buffer could embed the end sequence thus defeating the point of it. if you want to be compatible with xterm (who invented this feature), you want to filter: |
@DHowett-MSFT -- worth ingesting this page here concerning the security issues various implementations of bracketed paste mode may have: https://lwn.net/Articles/749992/ -- particularly http://thejh.net/misc/website-terminal-copy-paste |
@oising, thank you for that read. I think the best thing we could do is write tests for the specific security issues listed there and attempt to mitigate them as we implement the bracketed paste mode. |
Would it be possible and/or reasonable for starters to just have ConPTY pass through |
@DHowett Dustin, thanks for pointing me to this issue from the one I had opened concerning pasting into IPython / vi. Are there any workarounds in the meantime? |
In the meantime, before/after pasting in vim you can |
Several similar workarounds for
This will not persist between
I hope this helps someone! |
Done! |
Just a big THANK YOU to everyone involved - this is a huge time saver and help for my workflow. |
So bracketed paste will not work in ConPTY atm? correct? |
No it should work just fine in conpty (the Terminal uses conpty too 😉). Conhost (the vintage console) still needs to implement support for this itself, but that should be much simpler now. |
I have 1.15.2875.0 but this seems to be unsupported still. |
@dashesy i would encourage you to file a new issue and fill out the issue template. As far as we are aware, paste bracketing works fine for every client application that requests it. Filing a new issue would be the best way to draw attention to, and provide specific information about, the problem you're facing. |
This adds support for XTerm's "bracketed paste" mode in ConHost. When enabled, any pasted text is bracketed with a pair of escape sequences, which lets the receiving application know that the content was pasted rather than typed. ## References and Relevant Issues Bracketed paste mode was added to Windows Terminal in PR #9034. Adding it to ConHost ticks one more item off the list in #13408. ## Detailed Description of the Pull Request / Additional comments This only applies when VT input mode is enabled, since that is the way Windows Terminal currently works. When it comes to filtering, though, the only change I've made is to filter out the escape character, and only when bracketed mode is enabled. That's necessary to prevent any attempts to bypass the bracketing, but I didn't want to mess with the expected behavior for legacy apps if bracketed mode is disabled. ## Validation Steps Performed Manually tested in bash with `bind 'set enable-bracketed-paste on'` and confirmed that pasted content is now buffered, instead of being executed immediately. Also tested in VIM, and confirmed that you can now paste preformatted code without the autoindent breaking the formatting. Closes #395
Does the Windows console support bracket paste mode? I wasn't able to find any information about that.
The text was updated successfully, but these errors were encountered: