Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
691c6b1
Basic ANSI escapes working
lzybkr Aug 1, 2017
72fdf86
Fix rendering of selected text
lzybkr Aug 2, 2017
103ec35
Use correct continuation prompt background color
lzybkr Aug 2, 2017
de87cef
Support ansi escapes in unit test mock console
lzybkr Aug 2, 2017
54545d6
Move to .Net 4.6.1 in prep for .Net Standard 2.0
lzybkr Aug 2, 2017
8a0d05f
Properly clear buffer in unit tests that reuse console
lzybkr Aug 2, 2017
575a10d
Reset previous render before reading a line
lzybkr Aug 2, 2017
d9ec61d
Use correct color when overwriting with spaces
lzybkr Aug 2, 2017
e93b1e5
Define and use prompt in test host
lzybkr Aug 2, 2017
ef1bb9b
Get red prompt working again
lzybkr Aug 2, 2017
6ecbd09
Fix InvokePrompt
lzybkr Aug 3, 2017
ed2ca79
Add Test overloads to ease analysis of tests
lzybkr Aug 3, 2017
138b226
Add basic support for custom colors
lzybkr Aug 4, 2017
de5d7bd
Merge Foreground/Background options
lzybkr Aug 5, 2017
11fca62
Remove unreferenced methods
lzybkr Aug 9, 2017
820e423
PossibleCompletions fixed, all tests passing
lzybkr Aug 9, 2017
4d67c6b
MenuComplete mostly working
lzybkr Aug 13, 2017
e32582a
Require PowerShell V5
lzybkr Aug 14, 2017
66d34c6
MenuComplete filtering working now
lzybkr Aug 14, 2017
96772e4
Moving onwards towards minimal P/Invokes
lzybkr Aug 14, 2017
e4a529a
Fix auto-prompt analysis to cover more cases
lzybkr Aug 14, 2017
8550dad
Bump version to 2.0
lzybkr Aug 14, 2017
e53cc84
Update change log
lzybkr Aug 14, 2017
837921a
Introduce runtime check of platform
lzybkr Aug 14, 2017
e2fb174
Fix rendering artifacts from shorter renders
lzybkr Aug 18, 2017
8453d4c
Fix completion at bottom of buffer
lzybkr Aug 27, 2017
3aadd54
Specify Platform=AnyCPU for build automation
lzybkr Aug 27, 2017
1104eb0
Add .vs directory to .gitignore
lzybkr Aug 28, 2017
ad7d580
More end of buffer rendering fixes
lzybkr Aug 28, 2017
756d764
More menu rendering at end of buffer fixes
lzybkr Aug 28, 2017
602ecd4
Move more Win32 specific apis out of IConsole
lzybkr Aug 30, 2017
8fdecbf
Clear previous prompt in InvokePrompt
lzybkr Aug 30, 2017
62447ce
Paste from Windows clipboard without WinForms
lzybkr Sep 1, 2017
bbd3693
Require CLR 4.0.0, not 4.6.1
lzybkr Sep 1, 2017
dc70f4e
Copy to clipboard w/o WinForms
lzybkr Sep 2, 2017
5557fd3
Refactor CaptureScreen to isolate P/Invokes
lzybkr Sep 2, 2017
00dba93
Fix Paste unit test
lzybkr Sep 2, 2017
f080ce8
Disable test that needs clean mocking solution
lzybkr Sep 2, 2017
1d3a681
CaptureScreen: correctly set rtf and plain text
lzybkr Sep 2, 2017
1a623b9
Replace COORD with Point except in ScreenCapture
lzybkr Sep 2, 2017
1d009a3
More Windows refactoring
lzybkr Sep 2, 2017
ff80a13
Spelling comments
jsoref Aug 26, 2016
f1208cc
add space to switch-case statement in CommandValidationVisitor.Unreso…
jsoref Sep 2, 2016
6f46b23
Use HTTPS links for go.microsoft.com
xiaoyinl Aug 24, 2016
245000c
Remove #region
lzybkr Sep 3, 2017
c994e14
Set DefaultEditMode to Emacs on Linux / OS X
andyleejordan Jul 15, 2016
1cba31e
Portable history file settings with XDG support
May 24, 2016
fe5b918
Ignore case when binding PSReadline keyhandler functions
oising Aug 7, 2017
d8b8ed6
Fix Redo
palladia Apr 28, 2016
0c310fb
Fix for Linux remote script debugging hang
PaulHigin Sep 13, 2016
a7efcd2
XML comment cleanup
lzybkr Sep 3, 2017
29951e1
Fix for unknown fore/background color on Linux
lzybkr Sep 4, 2017
491a1ec
Fix comparison of keys in dispatch dictionary
andyleejordan Apr 29, 2016
f0a93e6
Fix directory completion for different file-systems
andyleejordan Apr 30, 2016
bff16f4
Correct resources namespace
lzybkr Sep 5, 2017
a1552f8
Don't change background on unknown default background
lzybkr Sep 5, 2017
6b0547c
Update sln for VS2017
lzybkr Sep 5, 2017
fb10c6d
Show tooltips by default in MenuComplete
lzybkr Sep 9, 2017
9374839
Fix WhatIsKey/ShowKeyBindings
lzybkr Sep 9, 2017
9e39cf0
Fix some rendering issues
lzybkr Sep 16, 2017
8edcf64
Use Unicode OuputEncoding for rendering
lzybkr Oct 6, 2017
63d2dcf
Portable custom key bindings
lzybkr Sep 30, 2017
42d5210
Fix Beep on Linux to use implemented api
lzybkr Oct 16, 2017
69d8074
Escape escapes in Get-PSReadLineOption output
lzybkr Oct 16, 2017
68e4038
Update Changes.txt
lzybkr Oct 16, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,6 @@ ChocolateyPackage/PSReadLine/
# gvim swap files
*.swp
*.swo

# Visual Studio cache/options directory
.vs/
6 changes: 3 additions & 3 deletions PSReadLine/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PSReadLine")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyCopyright("Copyright")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -36,8 +36,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.2")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0")]


[assembly: SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
40 changes: 12 additions & 28 deletions PSReadLine/BasicEditing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Language;
using Microsoft.PowerShell.PSReadLine;

namespace Microsoft.PowerShell
{
Expand Down Expand Up @@ -81,27 +82,10 @@ public static void CancelLine(ConsoleKeyInfo? key = null, object arg = null)
{
_singleton.ClearStatusMessage(false);
_singleton._current = _singleton._buffer.Length;
// We want to display ^C to show the line was canceled. Instead of appending ^C
// (or (char)3), we append 2 spaces so we don't affect tokenization too much, e.g.
// changing a keyword to a command.
_singleton._buffer.Append(" ");
_singleton.ReallyRender();

// Now that we've rendered with this extra spaces, go back and replace the spaces
// with ^C colored in red (so it stands out.)
var coordinates = _singleton.ConvertOffsetToCoordinates(_singleton._current);
var console = _singleton._console;
var consoleBuffer = _singleton._consoleBuffer;
int i = (coordinates.Y - _singleton._initialY) * console.BufferWidth + coordinates.X;
consoleBuffer[i].UnicodeChar = '^';
consoleBuffer[i].ForegroundColor = ConsoleColor.Red;
consoleBuffer[i].BackgroundColor = console.BackgroundColor;
consoleBuffer[i+1].UnicodeChar = 'C';
consoleBuffer[i+1].ForegroundColor = ConsoleColor.Red;
consoleBuffer[i+1].BackgroundColor = console.BackgroundColor;
console.WriteBufferLines(consoleBuffer, ref _singleton._initialY);

_singleton.PlaceCursor(0, coordinates.Y + 1);
_singleton.ForceRender();

_singleton._console.Write("\x1b[91m^C\x1b[0m");

_singleton._buffer.Clear(); // Clear so we don't actually run the input
_singleton._current = 0; // If Render is called, _current must be correct.
_singleton._currentHistoryIndex = _singleton._history.Count;
Expand Down Expand Up @@ -248,7 +232,7 @@ private bool AcceptLineImpl(bool validate)

if (renderNeeded)
{
ReallyRender();
ForceRender();
}

// Only run validation if we haven't before. If we have and status line shows an error,
Expand Down Expand Up @@ -283,8 +267,8 @@ private bool AcceptLineImpl(bool validate)
ClearStatusMessage(render: true);
}

var coordinates = ConvertOffsetToCoordinates(_current);
PlaceCursor(0, coordinates.Y + 1);
var point = ConvertOffsetToPoint(_current);
PlaceCursor(0, point.Y + 1);
_inputAccepted = true;
return true;
}
Expand Down Expand Up @@ -406,8 +390,8 @@ private bool UnresolvedCommandCouldSucceed(string commandName, Ast rootAst)
{
// The following are debugger commands that should be accepted if we're debugging
// because the console host will interpret these commands directly.
case 's': case 'v': case 'o': case 'c': case 'q': case'k': case 'l':
case 'S': case 'V': case 'O': case 'C': case 'Q': case'K': case 'L':
case 's': case 'v': case 'o': case 'c': case 'q': case 'k': case 'l':
case 'S': case 'V': case 'O': case 'C': case 'Q': case 'K': case 'L':
case '?': case 'h': case 'H':
// Ideally we would check $PSDebugContext, but it is set at function
// scope, and because we're in a module, we can't find that variable
Expand Down Expand Up @@ -482,7 +466,7 @@ public static void AddLine(ConsoleKeyInfo? key = null, object arg = null)
/// </summary>
public static void InsertLineAbove(ConsoleKeyInfo? key = null, object arg = null)
{
// Move the current postion to the beginning of the current line and only the current line.
// Move the current position to the beginning of the current line and only the current line.
if (_singleton.LineIsMultiLine())
{
int i = Math.Max(0, _singleton._current - 1);
Expand Down Expand Up @@ -512,7 +496,7 @@ public static void InsertLineAbove(ConsoleKeyInfo? key = null, object arg = null
/// </summary>
public static void InsertLineBelow(ConsoleKeyInfo? key = null, object arg = null)
{
// Move the current postion to the end of the current line and only the current line.
// Move the current position to the end of the current line and only the current line.
if (_singleton.LineIsMultiLine())
{
int i = _singleton._current;
Expand Down
33 changes: 29 additions & 4 deletions PSReadLine/Changes.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
### Version 1.?
### Version 2.0

Bug fixes:
New features:
* Interactive filtering during menu complete.
* Tooltips always on in MenuComplete (only displayed
if they give more information than the completion.)
* Support for VT escape sequences to specify colors.

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.
* Avoid reporting an error when stdin/stdout is redirected. There is still
no support for redirected stdin/stdout though.
* Fix YankToPercent off by 1 error.
* Fix error reported when running in container.
* Remove Ding from Backspace on an empty line
* Fix occasional hang reading history file
* Honor HistorySearchCursorMovesToEnd in Vi mode
* Fix cursor placement with CJK characters
* Fix key bindings with certain Windows keyboard layouts

Breaking changes:
* Requires PowerShell V5 or later and .Net 4.6.1
* Building requires VS2017
* Set-PSReadlineOption color parameters have changed
- Accept `object` instead of `ConsoleColor` to support accepting both
strings (VT escape sequences) and ConsoleColor
- Parameter names changed - no explicit Foreground/Background options anymore,
but aliases introduced so `-ForegroundColor` is the same as `-Color` and
`-ErrorForegroundColor` is the same as `-ErrorColor`.
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 "> "`,
replacing the string with the text that should turn red - be sure to include
any whitespace.

### Version 1.2

Expand Down Expand Up @@ -166,7 +191,7 @@ New features:
* SamplePSReadlineProfile.ps1 added with examples of custom key bindings
* Word movement takes DigitArgument
* HistoryNoDuplicates now works a little differently
- Dupicates are saved (it was a dubious memory optimization anyway)
- 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.
Expand Down Expand Up @@ -239,7 +264,7 @@ Bugs fixed:
* Ctrl+R with long search lines no longer causes big problems

Behavior change:
* Word functions now use delimiters. The previous behavior is availble
* 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
Expand Down
Loading