mirror of
https://github.com/PowerShell/PSReadLine
synced 2026-06-08 12:12:13 +00:00
Add BasicScrollingConsole to support test cases for scrolling up scenarios (#3081)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user