mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 00:07:58 +01:00
Ensure restore the original colors
This commit is contained in:
@@ -100,6 +100,8 @@ internal partial class WindowsOutput : OutputBase, IConsoleOutput
|
||||
private readonly nint _outputHandle;
|
||||
private nint _screenBuffer;
|
||||
private readonly bool _isVirtualTerminal;
|
||||
private readonly ConsoleColor _foreground;
|
||||
private readonly ConsoleColor _background;
|
||||
|
||||
public WindowsOutput ()
|
||||
{
|
||||
@@ -122,6 +124,11 @@ internal partial class WindowsOutput : OutputBase, IConsoleOutput
|
||||
//Enable alternative screen buffer.
|
||||
Console.Out.Write (EscSeqUtils.CSI_SaveCursorAndActivateAltBufferNoBackscroll);
|
||||
}
|
||||
else
|
||||
{
|
||||
_foreground = Console.ForegroundColor;
|
||||
_background = Console.BackgroundColor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -513,7 +520,8 @@ internal partial class WindowsOutput : OutputBase, IConsoleOutput
|
||||
else
|
||||
{
|
||||
// Simulate restoring the color and clearing the screen.
|
||||
Console.ResetColor ();
|
||||
Console.ForegroundColor = _foreground;
|
||||
Console.BackgroundColor = _background;
|
||||
Console.Clear ();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user