Changes.txt

### Version 2.0.0-beta2

Pre-release notes:

Bug fixes:

* Fix issue with keyboard layout changes (#667) (Thanks @powercode)
* Fix cursor placement after window resize (#682) (Thanks @jianyunt)
* Fix rendering of long lines on non-Windows (#686) (Thanks @jianyunt)
* Fix Ctrl+h/Backspace on non-Windows (#619) (Thanks @daxian-dbw)
* Fix some custom key bindings on Windows (#580) (Thanks @daxian-dbw)
* Fixed CompleteMenu in vi insert mode (#651) (Thanks @srdubya)
* Fix ExtraPromptLineCount for ClearScreen (#634) (Thanks @daxian-dbw)
* Support color escape sequences in PromptText (#653) (Thanks @powercode)
* Support Ctrl+u in vi insert mode (#628) (Thanks @srdubya)
* Fix keys needing AltGr (#617)
* Fix vi-mode cursor placement issues (#623) (Thanks @srdubya)
* Ignore exceptions when setting OutputEncoding
* Fix hang on closing on pre-Win10 (#609)
* Enable Ctrl+c on non-Windows (#610)
* Improve VT emulation for pre-Win10 (#605)

### Version 2.0.0-beta1

Pre-release notes:

There are known issues:

* Some custom key bindings are broken (#580)

Breaking changes:
* Requires PowerShell V5 or later and .Net 4.6.1
* Set-PSReadLineOption options have changed
  - To specify colors, use the new `-Color` parameter and pass a Hashtable
  - All other color options have been removed include `-ResetTokenColors`
  - To specify background colors, you must now use a VT escape sequence.
* Changing the end of the prompt to red may not work automatically anymore if
  your prompt is non-trivial. To fix, use `Set-PSReadLineOption -PromptText "> "`.
* Consistently use `PSReadLine` instead of `PSReadline` everywhere, APIs, cmdlets, files, etc.
* Building requires VS2017

New features:
* Interactive filtering during menu complete (#515) (Thanks @MVKozlov!)
* Redirected input now works (#564) (Thanks @parkovski!)
* Tooltips always on in MenuComplete (only displayed
  if they give more information than the completion.)
* Get-PSReadLineKeyHandler output is grouped by category. (#114)
* Support for VT escape sequences to specify colors.
* Shift+Insert bound to Paste in Windows mode (#484)
* Ctrl+t bound to SwapCharacters in Emacs mode (#538) (Thanks andrewcromwell!)
* Ctrl+x,Ctrl+e bound to ViEditVisually in Emacs mode (#478)
* HistoryNoDuplicates is now on by default (#208)

Bug fixes:
* DeleteChar no longer deletes any text left of the cursor in Windows/Emacs
  and matches vim behavior of working like <x> in command mode.
* Fix InvokePrompt when the prompt is > 1 line.
* Fix YankToPercent off by 1 error.
* Fix error reported when running in container.
* Catch and ignore execptions in InvokePrompt (#583)
* Get new completions on 2nd tab if 1st had 1 result (#238)
* Tab replaced with 4 spaces during paste (#144)
* Fix rendering after buffer resize (#418)
* Invoke external editor w/o AcceptLine (#339)
* Fix exception with UpArrow after a command line edit in vi-mode (#573) (Thanks @srdubya!)
* Treat DingDuration=0 as BellStyle.None (#364)
* Color long name parameters like --force as a parameter (#398)
* Allow CaptureScreen to be used w/o a key binding (#419)
* Ignore duplicates during tab completion (#413)
* Fix exception with negative count in Delete (#502)
* Use correct help file name (#507)
* Fix exception in ShowKeyBinding w/ custom handler (#505)
* Normalize filename for saving history (#512)
* Treat end of buffer as whitespace for vi words (#536)
* Fix exception with invalid CompletionResult (#534)
* Fix exception with negative count in Kill* (#540) (Thanks andrewcromwell!)
* Fixes to SwapCharacters (#538) (Thanks andrewcromwell!)
* Fix cursor placement with CJK characters (#542)
* Fix key bindings with certain Windows keyboard layouts (#168 #556)
* Remove Ding from Backspace on an empty line (#422)
* Fix occasional hang reading history file (#524)
* HistorySearchCursorMovesToEnd previously only worked in incremental search.
  It is now on by default, honored in the non-incremental search (HistorySearch)
  and also in Vi Command mode for non-search history recall. (#438 #530) (Thanks @srdubya!)


### Version 1.2

New features:
* Vi editing mode

New functions:
* InsertLineAbove
    - A new empty line is created above the current line regardless of where the cursor
      is on the current line. The cursor moves to the beginning of the new line.
* InsertLineBelow
    - A new empty line is created below the current line regardless of where the cursor
      is on the current line. The cursor moves to the beginning of the new line.

New key bindings:
* Ctrl+Enter bound to InsertLineAbove in Windows mode
* Ctrl+Shift+Enter bound to InsertLineBelow in Windows mode

Bug fixes:
* Home the first line of multi-line input fixed
* CaptureScreen captures colors colors correctly instead of guessing
* CaptureScreen scrolls the screen to ensure the selected line is visible
* CaptureScreen allows j/k for up/down (for the vi fans)
* Fixed uncommon syntax coloring bug with bare words that start with a variable
* Added sample handler for F7 emulation
* Fixed sample handler for Set-StrictMode error
* Improved error message when errors occur in custom handlers

### Version 1.1 (shipped w/ Windows 10)

Breaking change:
* Namespace PSConsoleUtilities has been renamed to Microsoft.PowerShell
* Default history file location changed to match Windows 10

### Version 1.0.0.13

New features:
* Enter now does some extra validation before accepting the input. If there are any parse
  errors or a command is not found, an error message is displayed, but you can continue editing,
  the erroneous line will not be added to history, and the error message will be cleared after
  you make an edit.
  You can press Enter a second time to force accepting the line if you choose.

  If you don't like the new behavior for Enter, you can revert to the old behavior with:
      Set-PSReadLineKeyHandler -Key Enter -Function AcceptLine

Bug fixes:
* Occasional exception with AcceptAndGetNext (Ctrl+O) followed by something other than Enter
* Event handlers that register for the engine event PowerShell.OnIdle should work now.
* ClearScreen now scrolls the screen to preserve as much output as possible
* Fix exception on error input during rendering after certain keywords like process, begin, or end.
* Fix exception after undo from menu completion
* Support CancelLine (Ctrl+C) and Abort (Ctrl+G in emacs) to cancel DigitArgument
* History recall now ignores command lines from other currently running sessions, but you can
  still find command lines from those sessions when searching history.
* Color any non-whitespace prompt character when there is an error, not just non-characters
* ScrollDisplayToCursor works a little better now.

New functions:
* ValidateAndAcceptLine
    Validate the command line (by making sure there are no parse errors, commands all exist,
    and possibly other sorts of validation), display an error if any errors, but don't add
    the command to history and clear the error after an edit.
* DeleteCharOrExit
    - emulate Ctrl+D in bash properly by exiting the process if the command line is empty
* ScrollDisplayUpLine, ScrollDisplayDownLine
    Scroll the screen up or down by a line instead of by the screen

New key bindings:
* Ctrl+D bound to DeleteCharOrExit in Emacs mode
* Ctrl+N/Ctrl+P bound to NextHistory/PreviousHistory in Emacs mode
* Ctrl+PageUp bound to ScrollDisplayUpLine
* Ctrl+PageDown bound to ScrollDisplayDownLine
* Alt+F7 bound to ClearHistory in Windows mode

New options:
* Set-PSReadLineOption
      -ErrorForegroundColor
      -ErrorBackgroundColor
          Colors used when ValidateAndAcceptLine reports an error

      -CommandValidationHandler
          A delegate that is called from ValidateAndAcceptLine that can perform custom validation
          and also fix the command line, e.g. to correct common typos.

New cmdlet:
* Remove-PSReadLineKeyHandler
    This will remove a key binding for previously bound keys.

Breaking change:
* Demo mode removed
    - Trying to bind functions EnableDemoMode or DisableDemoMode will result in an error.

### Version 1.0.0.12

New features:
* Multi-line editing is now practical. Home/End go to the start/end of the current line or
  start/end of the input in a reasonable way. Up/Down arrows will move across lines if the
  input has multiple lines and you are not in the middle of recalling history.

Bug fixes:
* Color the prompt character if there is an error for any non-alphanumeric character
* Fix an issue related to undo (which was commonly hit via Escape) and using history search
* Fix a bug where PowerShell events are not written to the console until PSReadLine returns
* Fixed so PowerTab now works with PSReadLine
* Highlight from history search is cleared before accepting a line now.
* Fixed MenuComplete so it clears the menu (which only happened on some systems)

New functions:
* NextLine
* PreviousLine
    - These functions are added for completeness, neither is particularly useful as the usual
      bindings for UpArrow/DownArrow are smart enough to recall history or change lines
      depending on the context.

New key bindings:
* F8/Shift+F8 bound to HistorySearchBackward/HistorySearchForward in Windows mode

### Version 1.0.0.11

Bug fixes:
* Fixed MenuComplete to actually work

### Version 1.0.0.10

New features:
* Added binding Ctrl+SpaceBar to MenuComplete in Windows and Emacs modes
  - If you want to old behavior of Ctrl+Spacebar, bind it to PossibleCompletions
* Added binding Alt+. (YankLastArg) to Windows mode
* Added diagnostics when an exception occurs to help reporting bugs

Bug fixes:
* SaveHistoryPath option fixed
* Fix ShowKeyBindings to not write blank lines
* Fixed bug with undo

### Version 1.0.0.9

New features:
* MenuComplete - like an interactive show completion
* Automatically save history
    - at process exit
    - incrementally and shared across sessions
    - don't save
  See parameters HistorySaveStyle and HistorySavePath to Set-PSReadLineOption
* Added sample custom binding for quickly changing directories in SamplePSReadLineProfile.ps1

Bug fixes:
* Items loaded from history work with RevertLine
* Recalling current line after up arrow works again

### Version 1.0.0.8

New features:
* SamplePSReadLineProfile.ps1 added with examples of custom key bindings
* Word movement takes DigitArgument
* HistoryNoDuplicates now works a little differently
    - Duplicates are saved (it was a dubious memory optimization anyway)
    - Recall will recall the most recently executed item instead of the first
* When at the last word, NextWord/ForwardWord now move to the end of line instead
  of the last character of the word.
* HistorySearchBackward/HistorySearchForward changes behavior slightly:
    - use emphasis like InteractiveHistorySearch
    - cursor always moves to end like PreviousHistory/NextHistory
* New api GetSelectionState to get the current selection (if any).
* New functions:
    - SelectBackwardsLine
    - SelectLine
    - SelectAll
    - CopyOrCancelLine
* New key bindings in Windows mode:
    - Alt+0 through Alt+9 and Alt+-: DigitArgument
    - Ctrl+R/Ctrl+S for interactive history search

Bug fixes:
* Backspace after a failed interactive history search (Ctrl+R) caused searching
  to fail if you typed anything other than backspace.

### Version 1.0.0.7

New features:
* CaptureScreen - copies selected portion of screen to clipboard in text and rtf
* InvokePrompt - re-evaluate the prompt while preserving the current input
* New functions to scroll the screen w/o using the mouse:
    - ScrollScreenUp
    - ScrollScreenDown
    - ScrollScreenTop
    - ScrollScreenToCursor
* Many small bug fixes

### Version 1.0.0.6

New features:
* CharacterSearch/CharacterSearchBackward
* AcceptAndGetNext (Ctrl+O in bash)
* Get-PSReadLineKeyHandler now returns unbound functions
* Get-PSReadLineKeyHandler has 2 new parameters: -Bound and -Unbound
* Set-PSReadLineKeyHandler parameter -LongDescription is now -Description
  (not breaking because I left an alias)
* WhatIsKey - display binding for a key
* ShowKeyBindings - show all bound keys
* Keyboard selection of text for cut/copy/delete. New functions:
  - Cut
  - Copy
  - KillRegion
  - SelectBackwardChar
  - SelectForwardChar
  - SelectBackwardWord
  - SelectForwardWord
  - SelectNextWord
  - SelectShellForwardWord
  - SelectShellBackwardWord

Breaking change:
* The properties in the output of Get-PSReadLineKeyHandler have changed.
  This is unlikely to break anyone though.

### Version 1.0.0.5

New features:
* Delimiter support in *Word functions
* DigitArgument (Alt-0,Alt-1,Alt-2,...,Alt-9,Alt--) to pass numeric arguments
* YankLastArg/YankNthArg to extract arguments from previous command lines
* History search is now case insensitive with an option to make it case sensitive

Bugs fixed:
* Shift+Backspace works like Backspace
* Ctrl+R with long search lines no longer causes big problems

Behavior change:
* Word functions now use delimiters. The previous behavior is available
  via a Shell*Word function, e.g. instead of KillWord, use ShellKillWord.

### Version 1.0.0.4

New features:
* Interactive history search (Ctrl+R)
* Brace matching function added (GotoBrace)
* Clear screen (Ctrl+L)

Bugs fixed:
* When showing possible completions, truncate at newline
* Prompt before showing a large number of completions
* Undo after paste works now
* Long pause after clicking on X to close powershell is now fixed

### Version 1.0.0.3

Bugs fixed:
* Removed CLR 4.5 dependency
* Fix bug where console paste didn't display everything in some cases

### Version 1.0.0.2

New features:
* Add a "demo mode" that shows keys pressed
* Add ETW event source for demo mode, key logger, macro recorder etc.
* Undo/redo
* Get-PSReadLineOption cmdlet
* Make specifying key handlers for builtins simpler
* Current un-entered line is saved and recalled when cycling through history
* Support syntax coloring of member names

Bugs fixed:
* Speed up pasting from the console
* Fix coloring of some operators
* Fix coloring in some command arguments
* Ctrl-C is handled a little better

Breaking changes:
* CLR 4.5 is now required.
* SetBufferState is gone because it doesn't support Undo/Redo

### Version 1.0.0.1

New features:
* History imported when module is loaded
* Ctrl+End/Ctrl+Home bindings emulate cmd
* Arbitrary two key chords
* Key handlers passed the invoking key and an optional argument
* Made Ding public for custom handlers

Bugs fixed:
* Alternate keyboards now supported
* Ctrl-C now properly emulates cmd

Breaking changes:
* MinimumHistoryCommandLength parameter removed from Set-PSReadLineOption
    - Can use this instead:
        Set-PSReadLineOption -AddToHistoryHandler { $args[0].Length -gt 3 }

### Version 1.0.0.0

Initial release