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

Unified Diff: sdk/lib/io/stdio.dart

Issue 2753233002: [dart:io] Move Platform.ansiSupported to {Stdin,Stdout}.supportsAnsiEscapes (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 | « sdk/lib/io/platform_impl.dart ('k') | tests/standalone/io/ansi_supported_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/stdio.dart
diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart
index 29ea48d2a4380dbb9ca1459fb12715eeff26bae4..5df26007a8c18292ebec9f6ae9ce27fb0ee8a376 100644
--- a/sdk/lib/io/stdio.dart
+++ b/sdk/lib/io/stdio.dart
@@ -137,6 +137,15 @@ class Stdin extends _StdStream implements Stream<List<int>> {
external void set lineMode(bool enabled);
/**
+ * When connected to a terminal, whether ANSI codes are supported.
Lasse Reichstein Nielsen 2017/03/17 08:55:29 This is very vague. "ANSI codes" should probably
Lasse Reichstein Nielsen 2017/03/17 08:55:29 It doesn't say what happens when it's not connecte
zra 2017/03/17 15:38:51 Done.
zra 2017/03/17 15:38:51 Done.
+ *
+ * This is `true` if the TERM environment variable contains the string
+ * 'xterm', except on Windows where support is detected only in recent
+ * versions of Windows 10.
Lasse Reichstein Nielsen 2017/03/17 08:55:28 This is very specific. Consider just saying: Not
zra 2017/03/17 15:38:51 Done. Flutter is recommending PowerShell on Windo
Lasse Reichstein Nielsen 2017/03/17 16:02:49 This is not Flutter specific, the comment applies
zra 2017/03/17 17:45:35 I'm afraid I don't follow you. You asked whether v
+ */
+ external bool get ansiSupported;
Lasse Reichstein Nielsen 2017/03/17 08:55:29 I'd prefer a name like `supportsAnsiEscapes` (or *
zra 2017/03/17 15:38:51 Done.
+
+ /**
* Synchronously read a byte from stdin. This call will block until a byte is
* available.
*
@@ -186,9 +195,19 @@ class Stdout extends _StdFileSink implements IOSink {
*/
int get terminalLines => _terminalLines(_fd);
+ /**
+ * When connected to a terminal, whether ANSI codes are supported.
+ *
+ * This is `true` if the TERM environment variable contains the string
+ * 'xterm', except on Windows where support is detected only in recent
+ * versions of Windows 10.
+ */
+ bool get ansiSupported => _ansiSupported(_fd);
+
external bool _hasTerminal(int fd);
external int _terminalColumns(int fd);
external int _terminalLines(int fd);
+ external static bool _ansiSupported(int fd);
/**
* Get a non-blocking `IOSink`.
« no previous file with comments | « sdk/lib/io/platform_impl.dart ('k') | tests/standalone/io/ansi_supported_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698