From e660e0d8ec7d7daf5e8a092b9c724cc2f9b259b5 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 7 Jun 2020 11:54:06 -0700 Subject: [PATCH] Improve buggy terminal emulator detection. --- src/musikcube/cursespp/Colors.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/musikcube/cursespp/Colors.cpp b/src/musikcube/cursespp/Colors.cpp index 1b7e7a1c4..16a97ccdb 100755 --- a/src/musikcube/cursespp/Colors.cpp +++ b/src/musikcube/cursespp/Colors.cpp @@ -37,6 +37,7 @@ #include #include #include +#include using namespace musik::core; using namespace cursespp; @@ -492,12 +493,17 @@ struct Theme { /* some terminals report custom colors are supported, and also don't error when calling init_color(), but don't actually work. */ + +static const std::set kTrueColorTerminalBacklist = { "vscode" }; + static bool canChangeColors() { -#ifdef __APPLE__ const char* termEnv = std::getenv("TERM_PROGRAM"); std::string term; if (termEnv && strlen(termEnv)) { term = std::string(termEnv); + if (kTrueColorTerminalBacklist.find(term) != kTrueColorTerminalBacklist.end()) { + return false; + } if (term == "Apple_Terminal") { const char* termVer = std::getenv("TERM_PROGRAM_VERSION"); if (termVer && strlen(termVer)) { @@ -512,10 +518,7 @@ static bool canChangeColors() { return false; } } - return can_change_color(); -#else return !!can_change_color(); -#endif } Colors::Colors() {