mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
tui: Add terminfo patches for linux on MacOS.
Also enable italics on Konsole when it is falsely claiming to be xterm. Also note the reasons for some of the patcher terminfo patches.
This commit is contained in:
@@ -1214,6 +1214,9 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
{
|
{
|
||||||
unibi_term *ut = data->ut;
|
unibi_term *ut = data->ut;
|
||||||
const char * xterm_version = os_getenv("XTERM_VERSION");
|
const char * xterm_version = os_getenv("XTERM_VERSION");
|
||||||
|
#if 0 // We don't need to identify this specifically, for now.
|
||||||
|
bool roxterm = !!os_getenv("ROXTERM_ID");
|
||||||
|
#endif
|
||||||
bool xterm = terminfo_is_term_family(term, "xterm");
|
bool xterm = terminfo_is_term_family(term, "xterm");
|
||||||
bool linuxvt = terminfo_is_term_family(term, "linux");
|
bool linuxvt = terminfo_is_term_family(term, "linux");
|
||||||
bool rxvt = terminfo_is_term_family(term, "rxvt");
|
bool rxvt = terminfo_is_term_family(term, "rxvt");
|
||||||
@@ -1227,6 +1230,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
|| terminfo_is_term_family(term, "iTerm.app");
|
|| terminfo_is_term_family(term, "iTerm.app");
|
||||||
// None of the following work over SSH; see :help TERM .
|
// None of the following work over SSH; see :help TERM .
|
||||||
bool iterm_pretending_xterm = xterm && iterm_env;
|
bool iterm_pretending_xterm = xterm && iterm_env;
|
||||||
|
bool konsole_pretending_xterm = xterm && konsole;
|
||||||
bool gnome_pretending_xterm = xterm && colorterm
|
bool gnome_pretending_xterm = xterm && colorterm
|
||||||
&& strstr(colorterm, "gnome-terminal");
|
&& strstr(colorterm, "gnome-terminal");
|
||||||
bool mate_pretending_xterm = xterm && colorterm
|
bool mate_pretending_xterm = xterm && colorterm
|
||||||
@@ -1260,25 +1264,37 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
// their own terminal types and terminfo entries, like PuTTY does, and not
|
// their own terminal types and terminfo entries, like PuTTY does, and not
|
||||||
// claim to be xterm. Or they would mimic xterm properly enough to be
|
// claim to be xterm. Or they would mimic xterm properly enough to be
|
||||||
// treatable as xterm.
|
// treatable as xterm.
|
||||||
#if 0 // We don't need to identify this specifically, for now.
|
|
||||||
bool roxterm = !!os_getenv("ROXTERM_ID");
|
// 2017-04 terminfo.src lacks these. genuine Xterm has them, as have
|
||||||
#endif
|
// the false claimants.
|
||||||
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b]0;");
|
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b]0;");
|
||||||
unibi_set_if_empty(ut, unibi_from_status_line, "\x07");
|
unibi_set_if_empty(ut, unibi_from_status_line, "\x07");
|
||||||
unibi_set_if_empty(ut, unibi_set_tb_margin, "\x1b[%i%p1%d;%p2%dr");
|
unibi_set_if_empty(ut, unibi_set_tb_margin, "\x1b[%i%p1%d;%p2%dr");
|
||||||
|
|
||||||
if (true_xterm) {
|
if (true_xterm) {
|
||||||
|
// 2017-04 terminfo.src lacks these. genuine Xterm has them.
|
||||||
unibi_set_if_empty(ut, unibi_set_lr_margin, "\x1b[%i%p1%d;%p2%ds");
|
unibi_set_if_empty(ut, unibi_set_lr_margin, "\x1b[%i%p1%d;%p2%ds");
|
||||||
unibi_set_if_empty(ut, unibi_set_left_margin_parm, "\x1b[%i%p1%ds");
|
unibi_set_if_empty(ut, unibi_set_left_margin_parm, "\x1b[%i%p1%ds");
|
||||||
unibi_set_if_empty(ut, unibi_set_right_margin_parm, "\x1b[%i;%p2%ds");
|
unibi_set_if_empty(ut, unibi_set_right_margin_parm, "\x1b[%i;%p2%ds");
|
||||||
}
|
}
|
||||||
if (iterm_pretending_xterm) {
|
if (true_xterm
|
||||||
|
|| iterm_pretending_xterm
|
||||||
|
|| gnome_pretending_xterm
|
||||||
|
|| konsole_pretending_xterm) {
|
||||||
|
// Apple's outdated copy of terminfo.src for MacOS lacks these.
|
||||||
|
// genuine Xterm and three false claimants have them.
|
||||||
unibi_set_if_empty(ut, unibi_enter_italics_mode, "\x1b[3m");
|
unibi_set_if_empty(ut, unibi_enter_italics_mode, "\x1b[3m");
|
||||||
|
unibi_set_if_empty(ut, unibi_exit_italics_mode, "\x1b[23m");
|
||||||
}
|
}
|
||||||
} else if (rxvt) {
|
} else if (rxvt) {
|
||||||
|
// 2017-04 terminfo.src lacks these. Unicode rxvt has them.
|
||||||
unibi_set_if_empty(ut, unibi_enter_italics_mode, "\x1b[3m");
|
unibi_set_if_empty(ut, unibi_enter_italics_mode, "\x1b[3m");
|
||||||
|
unibi_set_if_empty(ut, unibi_exit_italics_mode, "\x1b[23m");
|
||||||
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b]2");
|
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b]2");
|
||||||
unibi_set_if_empty(ut, unibi_from_status_line, "\x07");
|
unibi_set_if_empty(ut, unibi_from_status_line, "\x07");
|
||||||
unibi_set_if_empty(ut, unibi_set_tb_margin, "\x1b[%i%p1%d;%p2%dr");
|
// 2017-04 terminfo.src has older control sequences.
|
||||||
|
unibi_set_str(ut, unibi_enter_ca_mode, "\x1b[?1049h");
|
||||||
|
unibi_set_str(ut, unibi_exit_ca_mode, "\x1b[?1049l");
|
||||||
} else if (screen) {
|
} else if (screen) {
|
||||||
// per the screen manual; 2017-04 terminfo.src lacks these.
|
// per the screen manual; 2017-04 terminfo.src lacks these.
|
||||||
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b_");
|
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b_");
|
||||||
@@ -1287,14 +1303,21 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b_");
|
unibi_set_if_empty(ut, unibi_to_status_line, "\x1b_");
|
||||||
unibi_set_if_empty(ut, unibi_from_status_line, "\x1b\\");
|
unibi_set_if_empty(ut, unibi_from_status_line, "\x1b\\");
|
||||||
} else if (terminfo_is_term_family(term, "interix")) {
|
} else if (terminfo_is_term_family(term, "interix")) {
|
||||||
|
// 2017-04 terminfo.src lacks this.
|
||||||
unibi_set_if_empty(ut, unibi_carriage_return, "\x0d");
|
unibi_set_if_empty(ut, unibi_carriage_return, "\x0d");
|
||||||
} else if (linuxvt) {
|
} else if (linuxvt) {
|
||||||
// No bugs in the vanilla terminfo for our purposes.
|
// Apple's outdated copy of terminfo.src for MacOS lacks these.
|
||||||
|
unibi_set_if_empty(ut, unibi_parm_up_cursor, "\x1b[%p1%dA");
|
||||||
|
unibi_set_if_empty(ut, unibi_parm_down_cursor, "\x1b[%p1%dB");
|
||||||
|
unibi_set_if_empty(ut, unibi_parm_right_cursor, "\x1b[%p1%dC");
|
||||||
|
unibi_set_if_empty(ut, unibi_parm_left_cursor, "\x1b[%p1%dD");
|
||||||
} else if (putty) {
|
} else if (putty) {
|
||||||
// No bugs in the vanilla terminfo for our purposes.
|
// No bugs in the vanilla terminfo for our purposes.
|
||||||
} else if (iterm) {
|
} else if (iterm) {
|
||||||
|
// 2017-04 terminfo.src has older control sequences.
|
||||||
unibi_set_str(ut, unibi_enter_ca_mode, "\x1b[?1049h");
|
unibi_set_str(ut, unibi_enter_ca_mode, "\x1b[?1049h");
|
||||||
unibi_set_str(ut, unibi_exit_ca_mode, "\x1b[?1049l");
|
unibi_set_str(ut, unibi_exit_ca_mode, "\x1b[?1049l");
|
||||||
|
// 2017-04 terminfo.src lacks these.
|
||||||
unibi_set_if_empty(ut, unibi_set_tb_margin, "\x1b[%i%p1%d;%p2%dr");
|
unibi_set_if_empty(ut, unibi_set_tb_margin, "\x1b[%i%p1%d;%p2%dr");
|
||||||
unibi_set_if_empty(ut, unibi_orig_pair, "\x1b[39;49m");
|
unibi_set_if_empty(ut, unibi_orig_pair, "\x1b[39;49m");
|
||||||
unibi_set_if_empty(ut, unibi_enter_dim_mode, "\x1b[2m");
|
unibi_set_if_empty(ut, unibi_enter_dim_mode, "\x1b[2m");
|
||||||
|
Reference in New Issue
Block a user