Skip to content

Commit 30b798b

Browse files
committed
Fixes gui-cs#4274. Using Windows Host Console v2win is rendering window size badly using VSDebugConsole.exe
1 parent e352dde commit 30b798b

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Terminal.Gui/Drivers/V2/WindowsOutput.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ public WindowsOutput ()
117117

118118
if (_isVirtualTerminal)
119119
{
120-
//Enable alternative screen buffer.
121-
Console.Out.Write (EscSeqUtils.CSI_SaveCursorAndActivateAltBufferNoBackscroll);
120+
if (Environment.GetEnvironmentVariable ("VSAPPIDNAME") is null)
121+
{
122+
//Enable alternative screen buffer.
123+
Console.Out.Write (EscSeqUtils.CSI_SaveCursorAndActivateAltBufferNoBackscroll);
124+
}
122125
}
123126
else
124127
{
@@ -497,8 +500,17 @@ public void Dispose ()
497500

498501
if (_isVirtualTerminal)
499502
{
500-
//Disable alternative screen buffer.
501-
Console.Out.Write (EscSeqUtils.CSI_RestoreCursorAndRestoreAltBufferWithBackscroll);
503+
if (Environment.GetEnvironmentVariable ("VSAPPIDNAME") is null)
504+
{
505+
//Disable alternative screen buffer.
506+
Console.Out.Write (EscSeqUtils.CSI_RestoreCursorAndRestoreAltBufferWithBackscroll);
507+
}
508+
else
509+
{
510+
// Simulate restoring the color and clearing the screen.
511+
Console.ResetColor ();
512+
Console.Clear ();
513+
}
502514
}
503515
else
504516
{

0 commit comments

Comments
 (0)