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:
Aaron Gyes 2022-03-28 11:20:06 -07:00
parent de03322073
commit 9c96986b36

View file

@ -110,9 +110,10 @@ 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.
assert(curses_initialized);
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
// Helps Terminal.app/iTerm
#ifdef __APPLE__
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
// Helps Terminal.app/iTerm
if ((!enter_italics_mode || enter_italics_mode == "") || (!enter_dim_mode || enter_dim_mode == "")) {
const auto term_prog = parser.vars().get(L"TERM_PROGRAM");
if (!term_prog.missing_or_empty() &&
(term_prog->as_string() == L"Apple_Terminal" || term_prog->as_string() == L"iTerm.app")) {
@ -123,6 +124,7 @@ maybe_t<int> builtin_set_color(parser_t &parser, io_streams_t &streams, const wc
enter_dim_mode = dim_esc;
}
}
}
#endif
// Variables used for parsing the argument list.