| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Adds the Ctrl+Enter key binding for Linux that defaults to AcceptLine. This allows PSReadLine to work by default on Linux terminals like Alacritty where a newline in a paste comes across as the Ctrl+Enter key.
|
Finally, I was looking for a fix for months. Added to my profile and haven't looked back. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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
{ "KeyChar": "\n", "Key": "Enter", "Modifiers": "Control" }.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 returned
{ "KeyChar": "\r", "Key": "Enter", "Modifiers": 0 }As 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