Add ctrl+enter key binding for Linux #3983
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
Adds the Ctrl+Enter key binding for Linux that defaults to AcceptLine. This allows PSReadLine to work by default on Linux terminals like Alacritty (in tmux) where a newline in a paste comes across as the Ctrl+Enter key. Not all terminals on Linux will send a newline in a paste as this key but some do. Having this key handler means that pasting a string with newlines is preserved properly rather than as
You can replicate how a newline was handled in a tty with a .NET application by running the following Python code on Linux
The output on PowerShell 7.4/.NET 8 is
.NET introduced a rewrite of
Console.ReadKey()
in .NET 7 dotnet/runtime#72193 that changed how a\n
on a tty was handled. In the past this is what it returnedAs there were no modifiers the
\r
was treated as a newline and so just worked.I'm unsure how you wish for me to test this, any guidance there would be appreciated.
PR Checklist
Microsoft Reviewers: Open in CodeFlow