mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Fix ReadLineWithTabCompletion port
Revert change made within the function since the function itself is compiled out for the portable version of PowerShell.
This commit is contained in:
1 parent
b67d765b3a
commit
64efb9d799
1 file changed
+15
-11
@@ -1823,9 +1823,13 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
string input = null;
|
||||
string lastInput = "";
|
||||
string lastCompletion = "";
|
||||
|
||||
ReadLineResult rlResult = ReadLineResult.endedOnEnter;
|
||||
|
||||
#if !PORTABLE
|
||||
ConsoleHandle handle = ConsoleControl.GetActiveScreenBufferHandle();
|
||||
|
||||
string lastCompletion = "";
|
||||
Size screenBufferSize = RawUI.BufferSize;
|
||||
|
||||
// Save the cursor position at the end of the prompt string so that we can restore it later to write the
|
||||
@@ -1835,6 +1839,7 @@ namespace Microsoft.PowerShell
|
||||
|
||||
CommandCompletion commandCompletion = null;
|
||||
string completionInput = null;
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
@@ -1845,9 +1850,6 @@ namespace Microsoft.PowerShell
|
||||
|
||||
input = ReadLine(true, lastInput, out rlResult, false, false);
|
||||
|
||||
Coordinates endOfInputCursorPos = RawUI.CursorPosition;
|
||||
string completedInput = null;
|
||||
|
||||
if (input == null)
|
||||
{
|
||||
break;
|
||||
@@ -1858,6 +1860,13 @@ namespace Microsoft.PowerShell
|
||||
break;
|
||||
}
|
||||
|
||||
#if PORTABLE // Portable code only ends on enter (or no input), so tab is not processed
|
||||
throw new PlatformNotSupportedException("This readline state is unsupported in portable code!");
|
||||
#else
|
||||
|
||||
Coordinates endOfInputCursorPos = RawUI.CursorPosition;
|
||||
string completedInput = null;
|
||||
|
||||
if (rlResult == ReadLineResult.endedOnTab || rlResult == ReadLineResult.endedOnShiftTab)
|
||||
{
|
||||
int tabIndex = input.IndexOf(Tab, StringComparison.CurrentCulture);
|
||||
@@ -1946,19 +1955,13 @@ namespace Microsoft.PowerShell
|
||||
|
||||
if (deltaInput > 0)
|
||||
{
|
||||
Console.SetCursorPosition(endOfCompletionCursorPos.X, endOfCompletionCursorPos.Y);
|
||||
for (int i = 0; i < deltaInput; i++)
|
||||
{
|
||||
Console.Write(' ');
|
||||
}
|
||||
ConsoleControl.FillConsoleOutputCharacter(handle, ' ', deltaInput, endOfCompletionCursorPos);
|
||||
}
|
||||
|
||||
if (restOfLine != string.Empty)
|
||||
{
|
||||
lastCompletion = completedInput.Remove(completedInput.Length - restOfLine.Length);
|
||||
#if !PORTABLE
|
||||
SendLeftArrows(restOfLine.Length);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1967,6 +1970,7 @@ namespace Microsoft.PowerShell
|
||||
|
||||
lastInput = completedInput;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
while (true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user