Bring back BufferWidth and BufferHeight

This commit is contained in:
Andrew Schwartzmeyer 2016-01-17 22:15:15 -08:00 committed by Andrew Schwartzmeyer
parent a4fd57298d
commit 15e2edefba
2 changed files with 10 additions and 12 deletions

View file

@ -32,10 +32,8 @@ namespace Microsoft.PowerShell.Linux.Host
/// </summary>
public override Size BufferSize
{
get { return new Size(Console.WindowWidth, Console.WindowHeight); }
set { }
//get { return new Size(Console.BufferWidth, Console.BufferHeight); }
//set { Console.SetBufferSize(value.Width, value.Height); }
get { return new Size(Console.BufferWidth, Console.BufferHeight); }
set { Console.SetBufferSize(value.Width, value.Height); }
}
/// <summary>

View file

@ -688,10 +688,10 @@ namespace Microsoft.PowerShell.Linux.Host
/// <param name="delta">The number of characters to move.</param>
internal static void Move(int delta)
{
int position = Console.CursorTop * Console.WindowWidth + Console.CursorLeft + delta;
int position = Console.CursorTop * Console.BufferWidth + Console.CursorLeft + delta;
Console.CursorLeft = position % Console.WindowWidth;
Console.CursorTop = position / Console.WindowWidth;
Console.CursorLeft = position % Console.BufferWidth;
Console.CursorTop = position / Console.BufferWidth;
}
/// <summary>
@ -709,12 +709,12 @@ namespace Microsoft.PowerShell.Linux.Host
/// <param name="position">The new position.</param>
internal void Place(int position)
{
Console.CursorLeft = (this.anchorLeft + position) % Console.WindowWidth;
int cursorTop = this.anchorTop + (this.anchorLeft + position) / Console.WindowWidth;
if (cursorTop >= Console.WindowHeight)
Console.CursorLeft = (this.anchorLeft + position) % Console.BufferWidth;
int cursorTop = this.anchorTop + (this.anchorLeft + position) / Console.BufferWidth;
if (cursorTop >= Console.BufferHeight)
{
this.anchorTop -= cursorTop - Console.WindowHeight + 1;
cursorTop = Console.WindowHeight - 1;
this.anchorTop -= cursorTop - Console.BufferHeight + 1;
cursorTop = Console.BufferHeight - 1;
}
Console.CursorTop = cursorTop;