File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ static DefaultConsoleDriver()
1515 throw new InvalidOperationException ( Resource . Message_NotSupportedEnvironment ) ;
1616 }
1717
18- Console . TreatControlCAsInput = true ;
19-
2018 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
2119 {
2220 var hConsole = NativeMethods . GetStdHandle ( NativeMethods . STD_OUTPUT_HANDLE ) ;
@@ -30,6 +28,15 @@ static DefaultConsoleDriver()
3028 }
3129 }
3230
31+ public DefaultConsoleDriver ( )
32+ {
33+ _previousTreatControlCAsInput = Console . TreatControlCAsInput ;
34+
35+ Console . TreatControlCAsInput = true ;
36+ }
37+
38+ private readonly bool _previousTreatControlCAsInput ;
39+
3340 #region IDisposable
3441
3542 public void Dispose ( ) => Reset ( ) ;
@@ -44,6 +51,8 @@ public void Reset()
4451 {
4552 Console . CursorVisible = true ;
4653 Console . ResetColor ( ) ;
54+
55+ Console . TreatControlCAsInput = _previousTreatControlCAsInput ;
4756 }
4857
4958 public void ClearLine ( int top )
You can’t perform that action at this time.
0 commit comments