8000 Merge pull request #2 from donovanlange/update-psreadline · markfields/WindowsPowerShell@410c3fb · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 410c3fb

Browse files
authored
Merge pull request donovanlange#2 from donovanlange/update-psreadline
Update PsReadline to version 1.2
2 parents f41f281 + 6ffb4d2 commit 410c3fb

9 files changed

+713
-226
lines changed

Modules/PSReadLine/Changes.txt

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,153 @@
1+
### Version 1.2
2+
3+
New features:
4+
* Vi editing mode
5+
6+
New functions:
7+
* InsertLineAbove
8+
- A new empty line is created above the current line regardless of where the cursor
9+
is on the current line. The cursor moves to the beginning of the new line.
10+
* InsertLineBelow
11+
- A new empty line is created below the current line regardless of where the cursor
12+
is on the current line. The cursor moves to the beginning of the new line.
13+
14+
New key bindings:
15+
* Ctrl+Enter bound to InsertLineAbove in Windows mode
16+
* Ctrl+Shift+Enter bound to InsertLineBelow in Windows mode
17+
18+
Bug fixes:
19+
* Home the first line of multi-line input fixed
20+
* CaptureScreen captures colors colors correctly instead of guessing
21+
* CaptureScreen scrolls the screen to ensure the selected line is visible
22+
* CaptureScreen allows j/k for up/down (for the vi fans)
23+
* Fixed uncommon syntax coloring bug with bare words that start with a variable
24+
* Added sample handler for F7 emulation
25+
* Fixed sample handler for Set-StrictMode error
26+
* Improved error message when errors occur in custom handlers
27+
28+
### Version 1.1 (shipped w/ Windows 10)
29+
30+
Breaking change:
31+
* Namespace PSConsoleUtilities has been renamed to Microsoft.PowerShell
32+
* Default history file location changed to match Windows 10
33+
34+
### Version 1.0.0.13
35+
36+
New features:
37+
* Enter now does some extra validation before accepting the input. If there are any parse
38+
errors or a command is not found, an error message is displayed, but you can continue editing,
39+
the erroneous line will not be added to history, and the error message will be cleared after
40+
you make an edit.
41+
You can press Enter a second time to force accepting the line if you choose.
42+
43+
If you don't like the new behavior for Enter, you can revert to the old behavior with:
44+
Set-PSReadlineKeyHandler -Key Enter -Function AcceptLine
45+
46+
Bug fixes:
47+
* Occasional exception with AcceptAndGetNext (Ctrl+O) followed by something other than Enter
48+
* Event handlers that register for the engine event PowerShell.OnIdle should work now.
49+
* ClearScreen now scrolls the screen to preserve as much output as possible
50+
* Fix exception on error input during rendering after certain keywords like process, begin, or end.
51+
* Fix exception after undo from menu completion
52+
* Support CancelLine (Ctrl+C) and Abort (Ctrl+G in emacs) to cancel DigitArgument
53+
* History recall now ignores command lines from other currently running sessions, but you can
54+
still find command lines from those sessions when searching history.
55+
* Color any non-whitespace prompt character when there is an error, not just non-characters
56+
* ScrollDisplayToCursor works a little better now.
57+
58+
New functions:
59+
* ValidateAndAcceptLine
60+
Validate the command line (by making sure there are no parse errors, commands all exist,
61+
and possibly other sorts of validation), display an error if any errors, but don't add
62+
the command to history and clear the error after an edit.
63+
* DeleteCharOrExit
64+
- emulate Ctrl+D in bash properly by exiting the process if the command line is empty
65+
* ScrollDisplayUpLine, ScrollDisplayDownLine
66+
Scroll the screen up or down by a line instead of by the screen
67+
68+
New key bindings:
69+
* Ctrl+D bound to DeleteCharOrExit in Emacs mode
70+
* Ctrl+N/Ctrl+P bound to NextHistory/PreviousHistory in Emacs mode
71+
* Ctrl+PageUp bound to ScrollDisplayUpLine
72+
* Ctrl+PageDown bound to ScrollDisplayDownLine
73+
* Alt+F7 bound to ClearHistory in Windows mode
74+
75+
New options:
76+
* Set-PSReadlineOption
77+
-ErrorForegroundColor
78+
-ErrorBackgroundColor
79+
Colors used when ValidateAndAcceptLine reports an error
80+
81+
-CommandValidationHandler
82+
A delegate that is called from ValidateAndAcceptLine that can perform custom validation
83+
and also fix the command line, e.g. to correct common typos.
84+
85+
New cmdlet:
86+
* Remove-PSReadlineKeyHandler
87+
This will remove a key binding for previously bound keys.
88+
89+
Breaking change:
90+
* Demo mode removed
91+
- Trying to bind functions EnableDemoMode or DisableDemoMode will result in an error.
92+
93+
### Version 1.0.0.12
94+
95+
New features:
96+
* Multi-line editing is now practical. Home/End go to the start/end of the current line or
97+
start/end of the input in a reasonable way. Up/Down arrows will move across lines if the
98+
input has multiple lines and you are not in the middle of recalling history.
99+
100+
Bug fixes:
101+
* Color the prompt character if there is an error for any non-alphanumeric character
102+
* Fix an issue related to undo (which was commonly hit via Escape) and using history search
103+
* Fix a bug where PowerShell events are not written to the console until PSReadline returns
104+
* Fixed so PowerTab now works with PSReadline
105+
* Highlight from history search is cleared before accepting a line now.
106+
* Fixed MenuComplete so it clears the menu (which only happened on some systems)
107+
108+
New functions:
109+
* NextLine
110+
* PreviousLine
111+
- These functions are added for completeness, neither is particularly useful as the usual
112+
bindings for UpArrow/DownArrow are smart enough to recall history or change lines
113+
depending on the context.
114+
115+
New key bindings:
116+
* F8/Shift+F8 bound to HistorySearchBackward/HistorySearchForward in Windows mode
117+
118+
### Version 1.0.0.11
119+
120+
Bug fixes:
121+
* Fixed MenuComplete to actually work
122+
123+
### Version 1.0.0.10
124+
125+
New features:
126+
* Added binding Ctrl+SpaceBar to MenuComplete in Windows and Emacs modes
127+
- If you want to old behavior of Ctrl+Spacebar, bind it to PossibleCompletions
128+
* Added binding Alt+. (YankLastArg) to Windows mode
129+
* Added diagnostics when an exception occurs to help reporting bugs
130+
131+
Bug fixes:
132+
* SaveHistoryPath option fixed
133+
* Fix ShowKeyBindings to not write blank lines
134+
* Fixed bug with undo
135+
136+
### Version 1.0.0.9
137+
138+
New features:
139+
* MenuComplete - like an interactive show completion
140+
* Automatically save history
141+
- at process exit
142+
- incrementally and shared across sessions
143+
- don't save
144+
See parameters HistorySaveStyle and HistorySavePath to Set-PSReadlineOption
145+
* Added sample custom binding for quickly changing directories in SamplePSReadlineProfile.ps1
146+
147+
Bug fixes:
148+
* Items loaded from history work with RevertLine
149+
* Recalling current line after up arrow works again
150+
1151
### Version 1.0.0.8
2152

3153
New features:
Binary file not shown.

Modules/PSReadLine/PSReadline.dll

-122 KB
Binary file not shown.

Modules/PSReadLine/PSReadline.format.ps1xml

Lines changed: 0 additions & 41 deletions
This file was deleted.

Modules/PSReadLine/PSReadline.psd1

Lines changed: 9 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,17 @@
11
@{
2-
3-
# Script module or binary module file associated with this manifest.
42
RootModule = 'PSReadLine.psm1'
5-
6-
# Version number of this module.
7-
ModuleVersion = '1.0.0.8'
8-
9-
# ID used to uniquely identify this module
3+
NestedModules = @("Microsoft.PowerShell.PSReadLine.dll")
4+
ModuleVersion = '1.2'
105
GUID = '5714753b-2afd-4492-a5fd-01d9e2cff8b5'
11-
12-
# Author of this module
13-
Author = 'Jason Shirk'
14-
15-
# Copyright statement for this module
16-
Copyright = '(c) 2013. All rights reserved.'
17-
18-
# Description of the functionality provided by this module
6+
Author = 'Microsoft Corporation'
7+
CompanyName = 'Microsoft Corporation'
8+
Copyright = '(c) Microsoft Corporation. All rights reserved.'
199
Description = 'Great command line editing in the PowerShell console host'
20-
21-
# Minimum version of the Windows PowerShell engine required by this module
2210
PowerShellVersion = '3.0'
23-
24-
# Name of the Windows PowerShell host required by this module
25-
# PowerShellHostName = 'ConsoleHost'
26-
27-
# Minimum version of the Windows PowerShell host required by this module
28-
# PowerShellHostVersion = ''
29-
30-
# Minimum version of the .NET Framework required by this module
3111
DotNetFrameworkVersion = '4.0'
32-
33-
# Minimum version of the common language runtime (CLR) required by this module
3412
CLRVersion = '4.0'
35-
36-
# Type files (.ps1xml) to be loaded when importing this module
37-
# TypesToProcess = @()
38-
39-
# Format files (.ps1xml) to be loaded when importing this module
40-
FormatsToProcess = @('PSReadLine.format.ps1xml')
41-
42-
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
43-
NestedModules = @("PSReadLine.dll")
44-
45-
# Functions to export from this module
46-
FunctionsToExport = '*'
47-
48-
# Cmdlets to export from this module
49-
CmdletsToExport = '*'
50-
51-
# Aliases to export from this module
52-
AliasesToExport = '*'
53-
54-
# List of all modules packaged with this module.
55-
# ModuleList = @()
56-
57-
# List of all files packaged with this module
58-
# FileList = @()
59-
60-
# Private data to pass to the module specified in RootModule/ModuleToProcess
61-
# PrivateData = ''
62-
63-
# HelpInfo URI of this module
64-
# HelpInfoURI = ''
65-
13+
FunctionsToExport = 'PSConsoleHostReadline'
14+
CmdletsToExport = 'Get-PSReadlineKeyHandler','Set-PSReadlineKeyHandler','Remove-PSReadlineKeyHandler',
15+
'Get-PSReadlineOption','Set-PSReadlineOption'
16+
HelpInfoURI = 'http://go.microsoft.com/fwlink/?LinkId=528806'
6617
}
67-

Modules/PSReadLine/PSReadline.psm1

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
2-
#
3-
# .SYNOPSIS
4-
#
5-
# This function is called by the console host when reading input to execute commands.
6-
#
71
function PSConsoleHostReadline
82
{
9-
# PSHost doesn't expose it's runspace. The InternalHost does, but that won't
10-
# work for arbitrary hosts, so we turn off strict mode.
11-
Set-StrictMode -Off
12-
$remoteRunspace = if ($host.IsRunspacePushed) { $host.Runspace } else { $null }
13-
[PSConsoleUtilities.PSConsoleReadLine]::ReadLine($remoteRunspace)
3+
Microsoft.PowerShell.Core\Set-StrictMode -Off
4+
[Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace, $ExecutionContext)
145
}
15-
16-
# Load history
17-
Get-History | ForEach-Object { [PSConsoleUtilities.PSConsoleReadLine]::AddToHistory($_.CommandLine) }

0 commit comments

Comments
 (0)
0