Add BasicScrollingConsole to support test cases for scrolling up scenarios (#3081)

This commit is contained in:
Dongbo Wang
2021-12-14 15:14:03 -08:00
committed by GitHub
parent 8e6893c0ba
commit b76883665b
7 changed files with 849 additions and 57 deletions
+9
View File
@@ -867,6 +867,7 @@ namespace Microsoft.PowerShell
// getting shorter or longer.
var endOfCommandLine = ConvertOffsetToPoint(_buffer.Length);
var topAdjustment = (endOfCommandLine.Y + 1) - menu.Top;
int oldInitialY = _initialY;
if (topAdjustment != 0)
{
@@ -877,6 +878,14 @@ namespace Microsoft.PowerShell
// Render did not clear the rest of the command line which flowed
// into the menu, so we must do that here.
menu.SaveCursor();
if (oldInitialY > _initialY)
{
// Scrolling happened when drawing the menu, so we need to adjust
// this point as it was calculated before drawing the menu.
endOfCommandLine.Y -= oldInitialY - _initialY;
}
_console.SetCursorPosition(endOfCommandLine.X, endOfCommandLine.Y);
_console.Write(Spaces(_console.BufferWidth - endOfCommandLine.X));
menu.RestoreCursor();
+3 -1
View File
@@ -1108,7 +1108,9 @@ namespace Microsoft.PowerShell
internal static bool IsRunningCI(IConsole console)
{
return console.GetType().FullName == "Test.TestConsole";
Type consoleType = console.GetType();
return consoleType.FullName == "Test.TestConsole"
|| consoleType.BaseType.FullName == "Test.TestConsole";
}
}
}