Reconcile rawui.cs with System.Console
With the latest packages, a lot more System.Console API is available. This commit implements what is now available through the API. Where an API functions correctly on Linux, the result of a call through PowerShell works as expected. Where it is not, a nice `PlatformNotSupported` exception is thrown (and displayed by PowerShell). On Linux: - `$host.ui.RawUI.WindowTitle` can be set but cannot be get - `$host.ui.RawUI.CusorPosition` can be set and get - `$host.ui.RawUI.CursorSize` can be get but cannot be set - `$host.ui.RawUI.MaxPhysicalWindowSize` can be get - `$host.ui.RawUI.MaxWindowSize` can be get - `$host.ui.RawUI.WindowPosition` can be get but cannot be set - `$host.ui.RawUI.WindowSize` can be get but cannot be set - `$host.ui.RawUI.ReadKey` can be be used, but is only approximate
This commit is contained in:
parent
2e90b29cc8
commit
b257a2d2fc
|
@ -43,10 +43,8 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override Coordinates CursorPosition
|
public override Coordinates CursorPosition
|
||||||
{
|
{
|
||||||
get { throw new NotImplementedException(
|
get { return new Coordinates(Console.CursorLeft, Console.CursorTop); }
|
||||||
"The method or operation is not implemented."); }
|
set { Console.SetCursorPosition(value.X, value.Y); }
|
||||||
set { throw new NotImplementedException(
|
|
||||||
"The method or operation is not implemented."); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -56,10 +54,8 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override int CursorSize
|
public override int CursorSize
|
||||||
{
|
{
|
||||||
get { return 12; }
|
get { return Console.CursorSize; }
|
||||||
set { }
|
set { Console.CursorSize = value; }
|
||||||
//get { return Console.CursorSize; }
|
|
||||||
//set { Console.CursorSize = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -90,8 +86,7 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override Size MaxPhysicalWindowSize
|
public override Size MaxPhysicalWindowSize
|
||||||
{
|
{
|
||||||
// get { return new Size(Console.LargestWindowWidth, Console.LargestWindowHeight); }
|
get { return new Size(Console.LargestWindowWidth, Console.LargestWindowHeight); }
|
||||||
get { return new Size(1024,768); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -102,8 +97,7 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override Size MaxWindowSize
|
public override Size MaxWindowSize
|
||||||
{
|
{
|
||||||
// get { return new Size(Console.LargestWindowWidth, Console.LargestWindowHeight); }
|
get { return new Size(Console.LargestWindowWidth, Console.LargestWindowHeight); }
|
||||||
get { return new Size(1024,768); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -114,8 +108,7 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
public override Coordinates WindowPosition
|
public override Coordinates WindowPosition
|
||||||
{
|
{
|
||||||
get { return new Coordinates(Console.WindowLeft, Console.WindowTop); }
|
get { return new Coordinates(Console.WindowLeft, Console.WindowTop); }
|
||||||
// set { Console.SetWindowPosition(value.X, value.Y); }
|
set { Console.SetWindowPosition(value.X, value.Y); }
|
||||||
set { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -126,8 +119,7 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
public override Size WindowSize
|
public override Size WindowSize
|
||||||
{
|
{
|
||||||
get { return new Size(Console.WindowWidth, Console.WindowHeight); }
|
get { return new Size(Console.WindowWidth, Console.WindowHeight); }
|
||||||
// set { Console.SetWindowSize(value.Width, value.Height); }
|
set { Console.SetWindowSize(value.Width, value.Height); }
|
||||||
set { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -164,17 +156,13 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This API reads a pressed, released, or pressed and released keystroke
|
/// This API reads a pressed, released, or pressed and released keystroke
|
||||||
/// from the keyboard device, blocking processing until a keystroke is
|
/// from the keyboard device, blocking processing until a keystroke is
|
||||||
/// typed that matches the specified keystroke options. In this example
|
/// typed that matches the specified keystroke options.
|
||||||
/// this functionality is not needed so the method throws a
|
|
||||||
/// NotImplementException exception.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="options">Options, such as IncludeKeyDown, used when
|
/// <param name="options">Unused</param>
|
||||||
/// reading the keyboard.</param>
|
|
||||||
/// <returns>Throws a NotImplementedException exception.</returns>
|
|
||||||
public override KeyInfo ReadKey(ReadKeyOptions options)
|
public override KeyInfo ReadKey(ReadKeyOptions options)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException(
|
ConsoleKeyInfo key = Console.ReadKey();
|
||||||
"The method or operation is not implemented.");
|
return new KeyInfo((int)key.Key, key.KeyChar, new ControlKeyStates(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue