233 Commits
Author SHA1 Message Date
Jason Shirk 67584a4fd9 Make Insert/Replace public
Insert and Replace are now public so handlers can support undo.
2013-10-03 18:50:01 -07:00
Jason Shirk ac3cf6df09 Fix loading history
Changes to support undo broke loading history.
2013-09-30 13:58:17 -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 f5bcda90f6 Use string instead of StringBuffer in HistoryItem 2013-09-25 08:45:11 -07:00
Jason Shirk 6b2acc9892 Save current line for recall during history commands 2013-09-25 08:36:27 -07:00
Jason Shirk c9f044e012 Lay some groundwork to support undo 2013-09-23 22:11:39 -07:00
Jason Shirk ada63b90a2 Add coloring support for Member names 2013-09-19 14:58:38 -07:00
Jason Shirk 99dbbe0108 Fix coloring in generic tokens 2013-09-19 13:53:57 -07:00
Jason Shirk 7c677ded0b Correctly classify assignment tokens as operators 2013-09-19 11:57:36 -07:00
Jason Shirk 6473447343 Handle multi-line input better with CancelLine
Like cmd, we leave the input visible, but I appended
^C (or whatever key was used to cancel) so there is
a clue input was canceled.

Multi-line input is preserved as well.
2013-09-19 11:52:06 -07:00
Jason Shirk 52ba34535b Don't add empty lines to history 2013-09-19 11:32:25 -07:00
Jason Shirk d3ef249338 Add demo mode and ETW trace
Added ETW tracing for key presses (a key logger!) so it can be used
in a variety of ways, e.g. when doing performance profiling, you can
add a message of sorts via key presses if you turn on the provider.

The ETW tracing code depends on CLR 4.5, this might force some folks
to upgrade.

Added PSReadline.EnableDemoMode which uses the ETW trace to display
key presses while you type.  This is useful for talks and producing
screen captures to show the editing experience.
2013-09-19 09:18:19 -07:00
Jason Shirk c5351ddff7 Remove MinimumHistoryCommandLength
People seem to prefer all commands in history, so it seems better to have
fewer options.

The following can be used if the previous functionality is desired:

    Set-PSReadlineOption -AddToHistoryHandler { $args[0].Length -gt 3 }
2013-09-13 08:49:33 -07:00
Jason Shirk 1c75b8e4d5 Read PowerShell history into PSReadline on import
Added a public api to add command lines to PSReadline history.
Use this api when the module is loaded so people that
persist their history can recall those command lines without
any additional changes to their profile.
2013-09-12 22:41:34 -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 74bf36350c Fix cut and paste error that broke Ctrl-C 2013-09-12 06:03:29 -07:00
Jason Shirk 3e23733fd5 Support 2 key chords
Support for 2 key chords has been added.

There is a small breaking change in Set-PSReadlineKeyHandler
because the -CtrlX switch is no longer needed.  It could have
been left in, but it's better to just remove it - not very
many people use this module yet.

The signature of key handlers was also changed to better support
features that have not yet been implemented.  The signature change
shouldn't affect any existing key handlers because default arguments
should cover those cases.
2013-09-11 17:55:30 -07:00
Jason Shirk 94b6ad6d4d Add default mapping for Ctrl+C to Emacs mode 2013-09-10 22:52:12 -07:00
Jason Shirk f821898ade Handle Ctrl+C like PowerShell/cmd
Ctrl+C was being processed by the system - fix was to
change the console mode.

After that, to emulate cooked input mode, we return
to the host with an empty buffer so the input is
preserved and the prompt is evaluated again.
2013-09-10 18:35:37 -07:00
Jason Shirk da336b3a86 Make Ding public for use from custom key handlers. 2013-09-10 10:49:30 -07:00
Jason Shirk 2b948e7227 Support alternate keyboards
Control keys that weren't bound to actions were ignored to avoid
adding ugly glyphs.  Unfortunately with some keyboard layouts,
important keys like '|' are entered with Control.

Fix is to never ignore control keys and display the actual control
sequence like ^P.  This means some characters can now span more
than one cell.  I haven't done enough work yet to support CJK
characters, hopefully it will be as simple as the couple changes
needed for this fix.
2013-09-10 09:26:14 -07:00
Jason Shirk aeef8c5a14 Add Paste from clipboard. 2013-07-22 10:00:33 -07:00
Jason Shirk 48772e8be5 Merge branch 'master' of https://github.com/lzybkr/PSReadLine 2013-07-21 15:42:16 -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 a25cef506f Add cursor position as out parameter to GetBufferState. 2013-06-26 19:06:22 -07:00
Jason Shirk d8d9295abd Add api to get token/ast buffer state. 2013-06-19 22:37:57 -07:00
Jason Shirk a17d05d644 Add Get-PSReadlineKeyHandler
To make it easier to see what keys are bound, you can use the command Get-PSReadlineKeyHandler.

The command Set-PSReadlineKeyHandler also adds support for binding Ctrl-X prefixed commands in Emacs mode.
2013-05-24 19:56:34 -07:00
Jason Shirk 99c6bd650d Fix some more end of buffer problems. 2013-05-19 09:04:40 -07:00
Jason Shirk d2dcfa37a6 Fix a couple small completion bugs 2013-05-15 12:42:26 -07:00
Jason Shirk 198c53ef19 Fix problem with ShowCompletions at end of buffer
When the cursor was at the end of the buffer, ShowCompletions would cause an exception trying to move the cursor outside the buffer.

Fixed by writing an explicit newline - done using the native Console api so it isn't redirected by the test framework.
2013-05-15 00:15:16 -07:00
Jason Shirk bc9404b208 Don't insert garbage for non-printable keys.
Function keys and Meta keys should not insert anything if the key is not bound to any action.
2013-05-13 23:28:35 -07:00
Jason Shirk 28e07fdb43 Initial checkin. 2013-05-12 23:52:15 -07:00