mirror of
https://github.com/neovim/neovim.git
synced 2025-10-14 13:56:05 +00:00
tui: Disable BCE almost always. #7624
133ae5eeef
implemented BCE (background color erase). But we can't
trust terminfo, so it is safer disable BCE if we are not certain.
Per https://github.com/kovidgoyal/kitty/issues/160#issuecomment-346470545
terminal support for BCE seems to be (1) optional and (2) inconsistent.
ref #4210 #4421 #7035 #7337 #7381 #7425 #7618
This commit is contained in:
@@ -1234,11 +1234,9 @@ static int unibi_find_ext_str(unibi_term *ut, const char *name)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Several entries in terminfo are known to be deficient or outright wrong,
|
/// Patches the terminfo records after loading from system or built-in db.
|
||||||
/// unfortunately; and several terminal emulators falsely announce incorrect
|
/// Several entries in terminfo are known to be deficient or outright wrong;
|
||||||
/// terminal types. So patch the terminfo records after loading from an
|
/// and several terminal emulators falsely announce incorrect terminal types.
|
||||||
/// external or a built-in database. In an ideal world, the real terminfo data
|
|
||||||
/// would be correct and complete, and this function would be almost empty.
|
|
||||||
static void patch_terminfo_bugs(TUIData *data, const char *term,
|
static void patch_terminfo_bugs(TUIData *data, const char *term,
|
||||||
const char *colorterm, long vte_version,
|
const char *colorterm, long vte_version,
|
||||||
bool konsole, bool iterm_env)
|
bool konsole, bool iterm_env)
|
||||||
@@ -1304,6 +1302,11 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!true_xterm) {
|
||||||
|
// Cannot trust terminfo; safer to disable BCE. #7624
|
||||||
|
unibi_set_bool(ut, unibi_back_color_erase, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (xterm) {
|
if (xterm) {
|
||||||
// Termit, LXTerminal, GTKTerm2, GNOME Terminal, MATE Terminal, roxterm,
|
// Termit, LXTerminal, GTKTerm2, GNOME Terminal, MATE Terminal, roxterm,
|
||||||
// and EvilVTE falsely claim to be xterm and do not support important xterm
|
// and EvilVTE falsely claim to be xterm and do not support important xterm
|
||||||
@@ -1397,11 +1400,9 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
#define XTERM_SETAB_16 \
|
#define XTERM_SETAB_16 \
|
||||||
"\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e39%;m"
|
"\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e39%;m"
|
||||||
|
|
||||||
// Terminals where there is actually 256-colour SGR support despite what
|
// Terminals with 256-colour SGR support despite what terminfo says.
|
||||||
// the terminfo record may say.
|
|
||||||
if (unibi_get_num(ut, unibi_max_colors) < 256) {
|
if (unibi_get_num(ut, unibi_max_colors) < 256) {
|
||||||
// See http://fedoraproject.org/wiki/Features/256_Color_Terminals for
|
// See http://fedoraproject.org/wiki/Features/256_Color_Terminals
|
||||||
// more on this.
|
|
||||||
if (true_xterm || iterm || iterm_pretending_xterm) {
|
if (true_xterm || iterm || iterm_pretending_xterm) {
|
||||||
unibi_set_num(ut, unibi_max_colors, 256);
|
unibi_set_num(ut, unibi_max_colors, 256);
|
||||||
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF_256_COLON);
|
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF_256_COLON);
|
||||||
@@ -1417,8 +1418,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB_256);
|
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB_256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Terminals where there is actually 16-colour SGR support despite what
|
// Terminals with 16-colour SGR support despite what terminfo says.
|
||||||
// the terminfo record may say.
|
|
||||||
if (unibi_get_num(ut, unibi_max_colors) < 16) {
|
if (unibi_get_num(ut, unibi_max_colors) < 16) {
|
||||||
if (colorterm) {
|
if (colorterm) {
|
||||||
unibi_set_num(ut, unibi_max_colors, 16);
|
unibi_set_num(ut, unibi_max_colors, 16);
|
||||||
@@ -1427,9 +1427,8 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some terminals can not currently be trusted to report if they support
|
// Some terminals cannot be trusted to report DECSCUSR support. So we keep
|
||||||
// DECSCUSR or not. So we need to have a blacklist for when we should not
|
// blacklist for when we should not trust the reported features.
|
||||||
// trust the reported features.
|
|
||||||
if (!((vte_version != 0 && vte_version < 3900) || konsole)) {
|
if (!((vte_version != 0 && vte_version < 3900) || konsole)) {
|
||||||
// Dickey ncurses terminfo has included the Ss and Se capabilities,
|
// Dickey ncurses terminfo has included the Ss and Se capabilities,
|
||||||
// pioneered by tmux, since 2011-07-14. So adding them to terminal types,
|
// pioneered by tmux, since 2011-07-14. So adding them to terminal types,
|
||||||
|
Reference in New Issue
Block a user