mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08:00
Fix 256 color detection on xterm-like
bbc3fecbe
introduced a regression where support for 256 color was not
detected on xterm-like terminals that did not define the TERM_PROGRAM
env variable. Almost no terminal on linux define this variable.
This commit is contained in:
parent
f6e5a5c521
commit
0fac2e0496
|
@ -348,17 +348,17 @@ static void update_fish_color_support(const environment_t &vars) {
|
|||
// Assume that all 'xterm's can handle 256, except for Terminal.app from Snow Leopard
|
||||
wcstring term_program;
|
||||
if (auto tp = vars.get(L"TERM_PROGRAM")) term_program = tp->as_string();
|
||||
if (auto tpv = vars.get(L"TERM_PROGRAM_VERSION")) {
|
||||
if (term_program == L"Apple_Terminal" &&
|
||||
fish_wcstod(tpv->as_string().c_str(), nullptr) > 299) {
|
||||
if (term_program == L"Apple_Terminal") {
|
||||
auto tpv = vars.get(L"TERM_PROGRAM_VERSION");
|
||||
if (tpv && fish_wcstod(tpv->as_string().c_str(), nullptr) > 299) {
|
||||
// OS X Lion is version 299+, it has 256 color support (see github Wiki)
|
||||
support_term256 = true;
|
||||
FLOGF(term_support, L"256 color support enabled for TERM=%ls on Terminal.app",
|
||||
term.c_str());
|
||||
} else {
|
||||
support_term256 = true;
|
||||
FLOGF(term_support, L"256 color support enabled for TERM=%ls", term.c_str());
|
||||
}
|
||||
} else {
|
||||
support_term256 = true;
|
||||
debug(2, L"256 color support enabled for TERM=%ls", term.c_str());
|
||||
}
|
||||
} else if (cur_term != nullptr) {
|
||||
// See if terminfo happens to identify 256 colors
|
||||
|
|
Loading…
Reference in New Issue
Block a user