44 Commits
Author SHA1 Message Date
spaette 486388c59f Fix some typos in this repository (#3547) 2023-01-23 14:22:59 -08:00
Steve Lee ad74cef250 Don't ignore ConsoleKey.Packet type as that is simply Unicode (#2632) 2021-07-01 10:44:46 -07:00
Tyler James Leonhardt 5afeced01f Revert "Change the key binding 'Alt+D' to 'Alt+Shift+D' for the windows edit mode (#1037)" (#1040)
This reverts commit 3f6975c1a0.
2019-09-12 23:03:57 -07:00
Tyler James Leonhardt 3f6975c1a0 Change the key binding 'Alt+D' to 'Alt+Shift+D' for the windows edit mode (#1037) 2019-09-12 13:37:28 -07:00
Dongbo Wang f2f5531560 Avoid rendering dead keys (2nd attempt) (#945) 2019-06-17 13:38:46 -07:00
Dongbo Wang 22ceb03a12 Handle the dead key on Windows properly (#933) 2019-06-07 09:50:09 -07:00
Jason Shirk a7af25aa37 Stop dispatching on ConsoleKeyInfo (#831)
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
2019-03-20 16:14:05 -07:00
Jason Shirk 3d246d935f Remove Keys.ShouldInsert (#822)
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
2018-12-03 11:04:40 -08:00
Jason Shirk 14ddf0c032 Check error condition in VkKeyScan (#788)
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
2018-10-28 20:32:24 -07:00
Jason Shirk e1c5b51486 Fix initialization for non-US keyboards (#768)
Closes #614.
2018-09-28 09:28:27 -07:00
Staffan Gustafsson 3229956a19 Adding space as an essential PS character. (#711)
Space should be added even if a modifier is added.

Fix #719
2018-06-25 21:50:29 -07:00
Staffan Gustafsson bf36369f13 Always display special characters (#667)
Many of these are behind `AltGr` and we can't reliably determine when `AltGr` is needed.
2018-06-03 23:22:11 -07:00
Dongbo Wang 708787f8f5 Fix Ctrl+Backspace/Ctrl+h in Linux (#661)
Fix #619
2018-04-02 21:38:51 -07:00
Dongbo Wang 21cd4e3850 Fix a few custom key binding on Windows (#657)
Fix #580.
2018-03-25 11:11:13 -07:00
Jason Shirk e68ab02055 Fix keys that require AltGr for SelfInsert
Fix #617
2018-01-28 12:10:25 -08:00
Jason Shirk 963f4c571f Fix Ctrl+_ on Windows 2017-11-12 08:38:16 -08:00
Jason Shirk a5204ceb60 Fix ToString for a couple of key bindings 2017-11-11 20:39:39 -08:00
Jason Shirk c0faad2533 Add default binding Shift+Insert for paste
Fix #484
2017-11-04 09:49:03 -07:00
Jason Shirk 63d2dcf6da Portable custom key bindings
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.
2017-10-15 22:03:56 -07:00
Jason Shirk (POWERSHELL) 618b4971ef Move some apis to be internal 2016-01-17 08:52:40 -08:00
Keith Hill b0b441c080 Added InsertLineAbove and InsertLineBelow functions and set them up to key bind to Ctrl+Enter and Ctrl+Shift+Enter in Windows mode. Not being an emacs person, I'm not sure what key bindings these two functions would bind to. I also added unit tests for the two functions as well as a unit test for what I believe is a bug in the BeginningOfLine (home) function when in multiline mode. I also updated the project to have the appropriate default namespace so that the resource file gets re-generated with the correct resource name without having to resort to hacking the csproj file. There was also an issue with trying to run unit tests because the unit test setup of PSReadline sets engineInstrincs to null and that caused a null reference exception which I worked-around by testing for null first. 2015-07-20 19:54:33 -06:00
Jason Shirk (POWERSHELL) c986e0eae5 Rename namespace PSConsoleUtilities to Microsoft.PowerShell 2015-06-18 15:32:20 -07:00
Jason Shirk (POWERSHELL) 6408a4c96c Add copyright header 2015-06-18 15:04:49 -07:00
jason@truewheels.net dff47936ea Bind Alt+F7 to ClearHistory
cmd/PowerShell Windows mode supports clearing history with Alt+F7, so PSReadline will too.
2014-11-25 19:35:22 -08:00
jason@truewheels.net 040b75a742 Add bindings to scroll the screen up/down by line
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.
2014-10-16 18:33:01 -07:00
jazzdelightsme 649e48ff23 Bind F8 to HistorySearch*, similar to cmd.exe.
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.
2014-07-13 21:13:52 -07:00
jason@truewheels.net 900e3057f2 Cleanup some Resharper issues 2014-04-13 11:21:30 -07:00
jason@truewheels.net 3956b563c2 Add new functions to select to start/end of line
Function SelectBackwardsLine is bound to Shift+Home
Function SelectLine is bound to Shift+End
2014-02-06 08:24:12 -08:00
jason@truewheels.net 9afc78b50d Add screen scrolling support
New functions:

    * ScrollScreenUp
    * ScrollScreenDown
    * ScrollScreenTop
    * ScrollScreenToCursor
2014-02-05 23:11:37 -08:00
jason@truewheels.net 26f62c9725 Fix cut/paste typo 2014-01-16 08:32:07 -08:00
jason@truewheels.net ad294ba09e Add keyboard selection + cut/copy support
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)
2013-12-28 16:22:35 -08:00
jason@truewheels.net 653b492d56 Add new functions WhatIsKey and ShowKeyBindings
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.
2013-12-11 22:41:57 -08:00
jason@truewheels.net 933cda8d1c Add Windows mode bindings for character searching
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.)
2013-12-09 13:07:05 -08:00
jason@truewheels.net b4c22b7574 Add CharacterSearch/CharacterSearchBackward 2013-12-09 09:29:09 -08:00
jason@truewheels.net 0ef6b555e3 Implement yank-last-arg/yank-nth-arg
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.
2013-12-06 14:03:40 -08:00
jason@truewheels.net 78471f7255 Initial digit-argument support
Add support for digit-argument - currently only honored for self-insert.
2013-12-03 20:02:56 -08:00
Jason Shirk 47728e07ac Add Windows mode bindings for [Backward]KillWord
Like Visual Studio, Windows mode will use:
    Ctrl+Backspace - BackwardKillWord
    Ctrl+Delete - KillWord
2013-11-25 19:14:13 -08:00
Jason Shirk 52e9083d28 Add brace matching support 2013-10-21 08:20:11 -07:00
Jason Shirk 1db4656620 Add bindings for {Beginning|End}OfHistory 2013-09-28 09:35:42 -07:00
Jason Shirk acf98b0364 Initial undo/redo support 2013-09-27 20:36:16 -07:00
Jason Shirk 0b41d2f4e8 Add Ctrl+End/Ctrl+Home emulation in cmd mode
Ctrl+End deletes to end of line
Ctrl+Home deletes to start of line

Neither puts deleted text in the clipboard/kill ring.
2013-09-12 19:13:08 -07:00
Jason Shirk db2bc986e7 Update doc comments to reflect reality
Add a key binding for showing completions in cmd mode.
Add an api to set the cursor position.
2013-07-21 15:41:18 -07:00
Jason Shirk da207fb3b9 Add function keys. 2013-05-19 09:02:59 -07:00
Jason Shirk 28e07fdb43 Initial checkin. 2013-05-12 23:52:15 -07:00