mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +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.
|
||||
assert(curses_initialized);
|
||||
|
||||
// Hack in missing italics and dim capabilities omitted from MacOS xterm-256color terminfo
|
||||
// Helps Terminal.app/iTerm
|
||||
#ifdef __APPLE__
|
||||
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")) {
|
||||
const auto term = parser.vars().get(L"TERM");
|
||||
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;
|
||||
// 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")) {
|
||||
const auto term = parser.vars().get(L"TERM");
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue