Skip to content
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

Support xtermjs keymappings in Windows edit mode #877

Closed
TylerLeonhardt opened this issue Apr 1, 2019 · 6 comments · Fixed by #878
Closed

Support xtermjs keymappings in Windows edit mode #877

TylerLeonhardt opened this issue Apr 1, 2019 · 6 comments · Fixed by #878

Comments

@TylerLeonhardt
Copy link
Member

xtermjs-based terminal emulators are becoming more and more popular.

Here are some examples:

And with conpty support in Windows, these will likely grow in popularity even more. And more xtermjs based terminals will pop up.

The is great to see but is a problem for PSReadLine for Windows because xtermjs-based terminals align closer with UNIX terminals and can't correctly support certain keybindings like:

ctrl+space - interpreted as ctrl+@
ctrl+backspace - interpreted as ctrl+w
etc (I think @rkeithhill knows a few others)

Ask

Can we set these, and any other xtermjs anomalies, as the default keybindings for the Windows edit mode so that user's experience in these other terminals is what they expect in regular pwsh.exe?

In order to make sure it only gets applied to xtermjs-based terminals, @Tyriar will set TERM=xterm in node-pty by default on Windows and recommend to set xterm-256color on the process in the xterm.js repo (as that's more correct). We can then use TERM to apply these additional keybindings or not. (NOTE: we would check for either xterm or xterm-256color to cover our bases)

cc @SteveL-MSFT @rjmholt

@gwojan
Copy link

gwojan commented Apr 1, 2019

I like the idea of better support on Windows for the xtermjs emulators but seriously don't like the idea of setting with TERM because it messes with neovim support in the terminal.

I use neovim for git command line integration and setting $env:VISUAL for PSReadLine vi mode. Neovim chokes hard with $env:TERM set on Windows. After thinking a little more this would only be a problem if $env:TERM is being set...

@Tyriar
Copy link

Tyriar commented Apr 1, 2019

Neovim chokes hard with $env:TERM set on Windows

@gwojan any reason for this? Currently VS Code doesn't set TERM on Windows so this would be a change for us.

@lzybkr
Copy link
Member

lzybkr commented Apr 1, 2019

It should be safe to add these bindings by default in Windows mode without checking TERM. If a user has a custom binding, I think it will take precedence.

Note that we can't use Ctrl+@ in Emacs mode - it's already bound.

@TylerLeonhardt
Copy link
Member Author

Looks like we just need to add to the default keybindings here. @rkeithhill do you know of any others off the top of your head that I should add?

@rkeithhill
Copy link
Contributor

I know of these three:

Set-PSReadLineKeyHandler -Chord 'Ctrl+w' -Function BackwardKillWord
Set-PSReadLineKeyHandler -Chord 'Alt+D' -Function KillWord
Set-PSReadLineKeyHandler -Chord 'Ctrl+@' -Function MenuComplete

That's not to say there aren't more.

@TylerLeonhardt
Copy link
Member Author

I've added these in #878

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants