Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: pkg/front_end/lib/src/fasta/colors.dart

Issue 2753033002: Support terminal colors on Windows 10. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/colors.dart
diff --git a/pkg/front_end/lib/src/fasta/colors.dart b/pkg/front_end/lib/src/fasta/colors.dart
index 6f3214dca91430c06f29dd9fa30b0fdfdc5e53ce..f3891b917d50387f3ccdc2b196cefd395f55e936 100644
--- a/pkg/front_end/lib/src/fasta/colors.dart
+++ b/pkg/front_end/lib/src/fasta/colors.dart
@@ -98,9 +98,9 @@ String white(String string) => wrap(string, WHITE_COLOR);
/// Note: do not call this method directly, as it is expensive to
/// compute. Instead, use [CompilerContext.enableColors].
bool computeEnableColors(CompilerContext context) {
- if (Platform.isWindows) {
+ if (!Platform.ansiSupported) {
if (context.options.verbose) {
- print("Not enabling colors, running on Windows.");
+ print("Not enabling colors, 'Platform.ansiSupported' is false.");
}
return false;
}
@@ -119,6 +119,16 @@ bool computeEnableColors(CompilerContext context) {
return false;
}
+ if (Platform.isWindows) {
+ if (context.options.verbose) {
+ print("Enabling colors as OS is Windows.");
+ }
+ return true;
+ }
+
+ // We have to check if the terminal actually supports colors. Currently,
+ // `Platform.ansiSupported` is hard-coded to true on non-Windows platforms.
sortie 2017/03/16 10:32:03 This comment may get out of date in the future. Yo
ahe 2017/03/16 11:06:29 I normally expect that people look in the revision
+
// The `-S` option of `tput` allows us to query multiple capabilities at
// once.
ProcessResult result = Process.runSync(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698