-
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
Soft line breaks option when pasting from clipboard #15508
Comments
The proper implementation of this feature (imo) would include:
|
FWIW, I think it is strictly better for PowerShell to implement support for bracketed paste, which will also give it support for soft paste in other terminal emulators. I am somewhat worried about us committing to a niche feature when the right one is on the table. 😄 |
For reference, the PSReadLine bracketed paste issue is here: PowerShell/PSReadLine#1471 |
It is never happens because it would definitely be a breaking change for them. This will only be done when powershell/PSReadLine/.Net completely moves from the practice of using ReadConsoleInputW to ReadFile to read input. That is, it will never happen. WT supports this practice from the very beginning. WT is responsible for converting raw text strings into pressed keys. I think it makes sense to keep this practice until the end, as long as it is used by dependent projects. |
The reason why this will never happen is that PS: I apologize for using |
I have nothing against bracketed paste, but here it's just about setting only one bit (Shift modifier) for only one keyboard event associated with the |
How would this work on other platforms, though, since PowerShell also runs on Linux and macOS? Like if you've got two panes open in Windows Terminal, one side with Windows PowerShell and the other a Linux version of PowerShell under WSL, would soft line breaks only be expected to work in one pane? |
My guess is that the Shift modifier of the Enter key event will be ignored when translating the event stream to a text string. Something like |
In my setup the behavior of pwsh in WSL does not depend on the presence of the Shift modifier
Test with Terminal.Dev.2023-06-08.23-17-40.mp4The same result with enabled bracketed paste: Terminal.Dev.2023-06-09.00-35-40.mp4 |
See, this is the thing I have an issue with! Yeah, I just think: there is a standard for terminals to emit unmodified pasted text that works across the entire ecosystem, over ssh, on other platforms, etc.; why should we be the odd ones out and do something that only works properly when you're running a shell directly on Windows with no intermediary? PowerShell adding support for bracketed paste (yes, it will require them to do some work.) fixes PowerShell on macOS with iTerm2, Linux with foot and Konsole and libvte-based terminals, FreeBSD, etc. anywhere it runs. Windows Terminal adding support for pasted content being emitted with Shift+Enter instead of Enter for newlines only works for Terminal and PowerShell and then only so long as nobody is in between the two. |
Thirst of all they need a keyboard protocol to provide Shift+Enter multiline user experience. The bracketed paste support is just a small addon.
I think because others lack of keyboard protocol and they must invent it.
The General Keyboard Protocol will allow everyone to seamlessly migrate to it from using INPUT_RECORDS in the future. |
WT already owns the almost general keyboard protocol - Win32 Input Mode. Just extend it to allow an arbitrary number of code points contained at the end of the vt-sequence to be grapheme cluster aware. And allow the stream of these sequences to be interleaved with the raw text stream. An application that expects WIN32_INPUT_MODE will simply ignore the raw text stream. |
Ок. It is just another nice #8343 try to rise the cli interactivity level up. |
Description of the new feature/enhancement
Consider adding a soft line break option for pasting from the clipboard when ENABLE_PROCESSED_INPUT is disabled (e.g.
pwsh -Interactive
). This will allow users to paste multi-line text from the clipboard into a powershell-like shell as a single blob without line-by-line execution.Proposed technical implementation details (optional)
In my opinion, this is enough to add a Shift modifier to the generated Return key when converting a text string into keypress events.
When the Shift key is pressed in shells like powershell, a soft line break is added instead of executing the current line.
Related to #3449
x-link PowerShell/PSReadLine#579
Current behavior
Terminal.Dev.2023-06-03.23-49-31.mp4
Behavior with Shift modifier added to Return key event
Terminal.Dev.2023-06-03.23-48-34.mp4
The text was updated successfully, but these errors were encountered: