Change Cleanup to not call SetConsoleOutputWindow

This commit is contained in:
Tigger Kindel
2023-07-20 08:09:50 -06:00
committed by Tig
parent db2c78fff2
commit ba01db3e8c
2 changed files with 10 additions and 8 deletions

View File

@@ -164,7 +164,8 @@ namespace Terminal.Gui {
SetCursorVisibility (initialCursorVisibility.Value);
}
SetConsoleOutputWindow (out _);
// BUGBUG: Commenting this out fixes #2634
//SetConsoleOutputWindow (out _);
ConsoleMode = originalConsoleMode;
//ContinueListeningForConsoleEvents = false;
@@ -173,8 +174,9 @@ namespace Terminal.Gui {
Console.WriteLine ("Error: {0}", err);
}
if (ScreenBuffer != IntPtr.Zero)
if (ScreenBuffer != IntPtr.Zero) {
CloseHandle (ScreenBuffer);
}
ScreenBuffer = IntPtr.Zero;
}
@@ -1494,7 +1496,7 @@ namespace Terminal.Gui {
// If n is 2, clear entire screen (and moves cursor to upper left on DOS ANSI.SYS).
// If n is 3, clear entire screen and delete all lines saved in the scrollback buffer
// DO NOT USE 3J - even with the alternate screen buffer, it clears the entire scrollback buffer
Console.Out.Write ("\x1b[3J");
Console.Out.Write ("\x1b[0J");
}
}
@@ -1707,20 +1709,19 @@ namespace Terminal.Gui {
public override void End ()
{
WinConsole.Cleanup ();
WinConsole = null;
// Disable alternative screen buffer.
Console.Out.Write ("\x1b[?1047l");
// Needed for Windows Terminal
// Clear the alternative screen buffer from the cursor to the
// end of the screen.
// Note, [3J causes Windows Terminal to wipe out the entire NON ALTERNATIVE
// backbuffer! So we need to use [0J instead.
Console.Out.Write ("\x1b[0J");
// Disable alternative screen buffer.
Console.Out.Write ("\x1b[?1047l");
// Console.Out.Flush () is not needed. See https://stackoverflow.com/a/20450486/297526
}
/// <inheritdoc/>

View File

@@ -1103,6 +1103,7 @@ namespace Terminal.Gui {
// Init created. Apps that do any threading will need to code defensively for this.
// e.g. see Issue #537
foreach (var t in toplevels) {
t.Running = false;
t.Dispose ();
}