Bring back BufferWidth and BufferHeight
This commit is contained in:
parent
a4fd57298d
commit
15e2edefba
2 changed files with 10 additions and 12 deletions
|
@ -32,10 +32,8 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override Size BufferSize
|
public override Size BufferSize
|
||||||
{
|
{
|
||||||
get { return new Size(Console.WindowWidth, Console.WindowHeight); }
|
get { return new Size(Console.BufferWidth, Console.BufferHeight); }
|
||||||
set { }
|
set { Console.SetBufferSize(value.Width, value.Height); }
|
||||||
//get { return new Size(Console.BufferWidth, Console.BufferHeight); }
|
|
||||||
//set { Console.SetBufferSize(value.Width, value.Height); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -688,10 +688,10 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// <param name="delta">The number of characters to move.</param>
|
/// <param name="delta">The number of characters to move.</param>
|
||||||
internal static void Move(int delta)
|
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.CursorLeft = position % Console.BufferWidth;
|
||||||
Console.CursorTop = position / Console.WindowWidth;
|
Console.CursorTop = position / Console.BufferWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -709,12 +709,12 @@ namespace Microsoft.PowerShell.Linux.Host
|
||||||
/// <param name="position">The new position.</param>
|
/// <param name="position">The new position.</param>
|
||||||
internal void Place(int position)
|
internal void Place(int position)
|
||||||
{
|
{
|
||||||
Console.CursorLeft = (this.anchorLeft + position) % Console.WindowWidth;
|
Console.CursorLeft = (this.anchorLeft + position) % Console.BufferWidth;
|
||||||
int cursorTop = this.anchorTop + (this.anchorLeft + position) / Console.WindowWidth;
|
int cursorTop = this.anchorTop + (this.anchorLeft + position) / Console.BufferWidth;
|
||||||
if (cursorTop >= Console.WindowHeight)
|
if (cursorTop >= Console.BufferHeight)
|
||||||
{
|
{
|
||||||
this.anchorTop -= cursorTop - Console.WindowHeight + 1;
|
this.anchorTop -= cursorTop - Console.BufferHeight + 1;
|
||||||
cursorTop = Console.WindowHeight - 1;
|
cursorTop = Console.BufferHeight - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.CursorTop = cursorTop;
|
Console.CursorTop = cursorTop;
|
||||||
|
|
Loading…
Reference in a new issue