mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-31 23:28:45 +00:00
set_color: only fixup sitm/ritm/dim if NULL/empty
So we'll skip the hack should someone have a fixed terminfo or only do it on the first set_color command.
This commit is contained in:
parent
de03322073
commit
9c96986b36
1 changed files with 12 additions and 10 deletions
|
@ -110,17 +110,19 @@ maybe_t<int> builtin_set_color(parser_t &parser, io_streams_t &streams, const wc
|
||||||
// By the time this is called we should have initialized the curses subsystem.
|
// By the time this is called we should have initialized the curses subsystem.
|
||||||
assert(curses_initialized);
|
assert(curses_initialized);
|
||||||
|
|
||||||
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
|
|
||||||
// Helps Terminal.app/iTerm
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
const auto term_prog = parser.vars().get(L"TERM_PROGRAM");
|
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
|
||||||
if (!term_prog.missing_or_empty() &&
|
// Helps Terminal.app/iTerm
|
||||||
(term_prog->as_string() == L"Apple_Terminal" || term_prog->as_string() == L"iTerm.app")) {
|
if ((!enter_italics_mode || enter_italics_mode == "") || (!enter_dim_mode || enter_dim_mode == "")) {
|
||||||
const auto term = parser.vars().get(L"TERM");
|
const auto term_prog = parser.vars().get(L"TERM_PROGRAM");
|
||||||
if (!term.missing_or_empty() && (term->as_string() == L"xterm-256color")) {
|
if (!term_prog.missing_or_empty() &&
|
||||||
enter_italics_mode = sitm_esc;
|
(term_prog->as_string() == L"Apple_Terminal" || term_prog->as_string() == L"iTerm.app")) {
|
||||||
exit_italics_mode = ritm_esc;
|
const auto term = parser.vars().get(L"TERM");
|
||||||
enter_dim_mode = dim_esc;
|
if (!term.missing_or_empty() && (term->as_string() == L"xterm-256color")) {
|
||||||
|
enter_italics_mode = sitm_esc;
|
||||||
|
exit_italics_mode = ritm_esc;
|
||||||
|
enter_dim_mode = dim_esc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue