Skip to content

Commit 138924c

Browse files
bkonyiCommit Queue
authored andcommitted
[ dart:io ] Add tmux terminals to list of terminals known to support ANSI
Fixes flutter/flutter#142861 TEST=N/A Change-Id: I208c597f33c622d19419202351dd17d39ec82bc3 CoreLibraryReviewExempt: only dart:io Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419280 Commit-Queue: Ben Konyi <bkonyi@google.com> Reviewed-by: Brian Quinlan <bquinlan@google.com>
1 parent 92df34d commit 138924c

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#### `dart:io`
1212

1313
- Added support `HttpClientBearerCredentials`.
14+
- Update `Stdout.supportsAnsiEscapes` and `Stdin.supportsAnsiEscapes` to
15+
return `true` for `TERM` containing `tmux` values.
1416

1517
#### `dart:html`
1618

runtime/bin/stdio_linux.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ static bool TermIsKnownToSupportAnsi() {
109109
}
110110

111111
return strstr(term, "xterm") != nullptr ||
112-
strstr(term, "screen") != nullptr || strstr(term, "rxvt") != nullptr;
112+
strstr(term, "screen") != nullptr || strstr(term, "rxvt") != nullptr ||
113+
strstr(term, "tmux") != nullptr;
113114
}
114115

115116
bool Stdin::AnsiSupported(intptr_t fd, bool* supported) {

runtime/bin/stdio_macos.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ static bool TermIsKnownToSupportAnsi() {
109109
}
110110

111111
return strstr(term, "xterm") != nullptr ||
112-
strstr(term, "screen") != nullptr || strstr(term, "rxvt") != nullptr;
112+
strstr(term, "screen") != nullptr || strstr(term, "rxvt") != nullptr ||
113+
strstr(term, "tmux") != nullptr;
113114
}
114115

115116
bool Stdin::AnsiSupported(intptr_t fd, bool* supported) {

sdk/lib/io/stdio.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ class Stdin extends _StdStream implements Stream<List<int>> {
178178
///
179179
/// The ANSI color selection is generally supported.
180180
///
181-
/// Currently, a `TERM` environment variable containing the string `xterm`
182-
/// will be taken as evidence that ANSI escape sequences are supported.
183-
/// On Windows, only versions of Windows 10 after v.1511
184-
/// ("TH2", OS build 10586) will be detected as supporting the output of
185-
/// ANSI escape sequences, and only versions after v.1607 ("Anniversary
181+
/// Currently, a `TERM` environment variable containing the string `xterm`,
182+
/// `screen`, `rxvt`, or `tmux` will be taken as evidence that ANSI escape
183+
/// sequences are supported. On Windows, only versions of Windows 10 after
184+
/// v.1511 ("TH2", OS build 10586) will be detected as supporting the output
185+
/// of ANSI escape sequences, and only versions after v.1607 ("Anniversary
186186
/// Update", OS build 14393) will be detected as supporting the input of
187187
/// ANSI escape sequences.
188188
external bool get supportsAnsiEscapes;

0 commit comments

Comments
 (0)