fix FLUTTER_ANSI_TERMINAL check (#8544)
* fix FLUTTER_ANSI_TERMINAL check should have been included in the previous PR :( * review comments
This commit is contained in:
committed by
GitHub
parent
c54cc96905
commit
ae1a719e03
@@ -18,10 +18,11 @@ If (Test-Path Env:\FLUTTER_ANSI_TERMINAL) { Remove-Item Env:\FLUTTER_ANSI_TERMIN
|
||||
$stdout = [Win32.NativeMethods]::GetStdHandle(-11) # STD_OUTPUT_HANDLE
|
||||
If ($stdout -ne -1) {
|
||||
$mode = 0
|
||||
$result = [Win32.NativeMethods]::GetConsoleMode($stdout, [ref]$mode)
|
||||
If ($result) {
|
||||
If ([Win32.NativeMethods]::GetConsoleMode($stdout, [ref]$mode)) {
|
||||
$mode = $mode -bor 4 # ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
$env:FLUTTER_ANSI_TERMINAL = [Win32.NativeMethods]::SetConsoleMode($stdout, $mode)
|
||||
If ([Win32.NativeMethods]::SetConsoleMode($stdout, $mode)) {
|
||||
$env:FLUTTER_ANSI_TERMINAL = "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -245,8 +245,8 @@ class AnsiTerminal {
|
||||
AnsiTerminal() {
|
||||
String term = platform.environment['TERM'];
|
||||
// FLUTTER_ANSI_TERMINAL is a work-around for https://github.com/dart-lang/sdk/issues/28614
|
||||
String flutterAnsiTerm = platform.environment['FLUTTER_ANSI_TERMINAL'];
|
||||
supportsColor = (term != null && term != 'dumb') || (flutterAnsiTerm != null);
|
||||
bool flutterAnsiTerm = platform.environment.containsKey('FLUTTER_ANSI_TERMINAL');
|
||||
supportsColor = (term != null && term != 'dumb') || flutterAnsiTerm;
|
||||
}
|
||||
|
||||
static const String KEY_F1 = '\u001BOP';
|
||||
|
||||
Reference in New Issue
Block a user