Skip to content

Commit 0e6aac2

Browse files
Merge pull request #4058 from zloylos:support-kitty-term
PiperOrigin-RevId: 488463135 Change-Id: I4180d766dabbe438210904e743e6e963122540f5
2 parents 42c6f57 + 4b7f945 commit 0e6aac2

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

googletest/src/gtest.cc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,15 +3252,16 @@ bool ShouldUseColor(bool stdout_is_tty) {
32523252
#else
32533253
// On non-Windows platforms, we rely on the TERM variable.
32543254
const char* const term = posix::GetEnv("TERM");
3255-
const bool term_supports_color = term != nullptr && (
3256-
String::CStringEquals(term, "xterm") ||
3257-
String::CStringEquals(term, "xterm-color") ||
3258-
String::CStringEquals(term, "screen") ||
3259-
String::CStringEquals(term, "tmux") ||
3260-
String::CStringEquals(term, "rxvt-unicode") ||
3261-
String::CStringEquals(term, "linux") ||
3262-
String::CStringEquals(term, "cygwin") ||
3263-
String::EndsWithCaseInsensitive(term, "-256color"));
3255+
const bool term_supports_color =
3256+
term != nullptr && (String::CStringEquals(term, "xterm") ||
3257+
String::CStringEquals(term, "xterm-color") ||
3258+
String::CStringEquals(term, "xterm-kitty") ||
3259+
String::CStringEquals(term, "screen") ||
3260+
String::CStringEquals(term, "tmux") ||
3261+
String::CStringEquals(term, "rxvt-unicode") ||
3262+
String::CStringEquals(term, "linux") ||
3263+
String::CStringEquals(term, "cygwin") ||
3264+
String::EndsWithCaseInsensitive(term, "-256color"));
32643265
return stdout_is_tty && term_supports_color;
32653266
#endif // GTEST_OS_WINDOWS
32663267
}

googletest/test/googletest-color-test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def testNoEnvVarNoFlag(self):
7878
self.assert_(UsesColor('cygwin', None, None))
7979
self.assert_(UsesColor('xterm', None, None))
8080
self.assert_(UsesColor('xterm-color', None, None))
81+
self.assert_(UsesColor('xterm-kitty', None, None))
8182
self.assert_(UsesColor('xterm-256color', None, None))
8283

8384
def testFlagOnly(self):

googletest/test/gtest_unittest.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6636,6 +6636,9 @@ TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
66366636
SetEnv("TERM", "xterm-color"); // TERM supports colors.
66376637
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
66386638

6639+
SetEnv("TERM", "xterm-kitty"); // TERM supports colors.
6640+
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
6641+
66396642
SetEnv("TERM", "xterm-256color"); // TERM supports colors.
66406643
EXPECT_TRUE(ShouldUseColor(true)); // Stdout is a TTY.
66416644

0 commit comments

Comments
 (0)