There are likely issues introduced by this PR,
but I'm merging for a new Beta so this code gets more testing.
* Introduce PSKeyInfo type alias
* Explicit conversions b/w ConsoleKeyInfo and PSKeyInfo
* Change tests to use actual ConsoleKeyInfo data
* Add fr-FR keyboard layout tests
* Add KeyInfo-ru-RU-windows.json (#839)
All impossible without Shift shortcuts labeled as "Investigate: true"
Alt+Spacebar tracked by windows itself
* Add KeyInfo for Polish (Programmers) layout on Windows and Linux (#870)
On Windows *Alt+Spacebar* is hijacked by Windows
On Linux any *Alt+F1-12* combination was not detected
The method Keys.ShouldInsert was a misguided attempt to avoid inserting
keys where there is no binding but the key really doesn't make sense as
input.
Unfortunately it is just causing more pain and probably wasn't
addressing a serious problem, so I'm removing it.
Fix#798
VkKeyScan returns -1 when there is no key mapping for the given
character.
This possiblity was not considered, resulting in an attempt to add
duplicate (but invalid) keys to the CtrlKeyToKeyMap.
Fixes#787
Rewrote the custom key binding code to be more portable.
Some runtime checks are necessary because of impossible to reconcile
differences.
Some Win32 P/Invoke calls are still needed due to lack of information in
the ConsoleKeyInfo.
Some keys are currently not available on Linux due to a CLR bug, others
aren't available ever because terminals don't unique character sequences
for a given key press that might differ in just the Shift or Ctrl state.
New functions:
ScrollDisplayUpLine
ScrollDisplayDownLine
And corresponding key bindings Ctrl+PageUp/Ctrl+PageDown
These functions accept a numeric argument, but the DigitArgument
implementation isn't compatible with scrolling the screen, so
it's not that useful unless a custom binding wants to do
something interesting, like scroll half a screen.
It's not /exactly/ the same as cmd.exe. For instance, it doesn't cycle
through results, but since you can use Shift+F8, to go the other way, it
still gets the job done.
Shift+Left/Right arrow now selects text
Shift+Ctrl+Left/Right arrow now selects words (Windows mode)
Alt+Shift+F/Alt+Shift+B now select words (Emacs mode)
Del/Backspace deletes highlighted region
Ctrl+X cuts to system clipboard (Windows mode)
Shift+Ctrl+C copys selection or full line to system clipboard (Windws mode)
New unbound function KillRegion which kills text b/w cursor and mark (unbound)
WhatIsKey prompts for a key and then shows what it is bound to.
ShowKeyBindings is like running Get-PSReadlineKeyBindings, but
does so without needing to run a command and preserves the current
input line.
F3/Shift+F3 are now bound to character searching in Windows mode.
This roughly matches Visual Studio bindings.
Note that traditionally F3 copies text from previous line starting
using the position of the cursor in the current line. It's not
hard to implement, but I'm not sure it's a useful feature, especially
with YankLastArg (which I could see mapping to F3 but probably won't.)
Support for yank-last-arg and yank-nth-arg has been added.
Combined with digit-argument, these functions provide a nice way
to copy arguments from previous commands fairly easily.
For example, to copy the 2nd argument from a command 2 entries back,
you can use: Alt+2 Alt+. Alt+.
I also tweaked digit-argument slightly so that when you start with
a negative argument (Alt--) the first digit can override the -1.
In Bash, to enter something like -2, you have to think backwards
and type Alt-2 Alt-- because Alt-- Alt-2 ends up giving you -12.