aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com>2017-05-03 19:47:03 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-05-04 16:18:36 +0200
commit052c2d0a0f68a210038123608c00d4e0ff360161 (patch)
treee4b18e7488346a176e0cb5a625bd13021ccc0c36 /src
parent3c0cc028b7e787e3e87f21976d8b6333bf488219 (diff)
downloadrneovim-052c2d0a0f68a210038123608c00d4e0ff360161.tar.gz
rneovim-052c2d0a0f68a210038123608c00d4e0ff360161.tar.bz2
rneovim-052c2d0a0f68a210038123608c00d4e0ff360161.zip
tui: Also fix "linux*" terminfo entries. #6673
The terminfo entry for linux only advertises 8 colours, but nvim tries to make it display 16 colours anyway, resulting in erroneous SGR control sequences for colours 8 and above. The Linux kernel terminal emulator itself has actually understood the 256-colour control sequences since version 4.8 and the 16-colour control sequences since version 4.9. Thus we apply the same terminfo fixup as we apply for *xterm* and *256*, to emit the 16-colour and 256-colour control sequences even if terminfo's setaf and setab do not advertise them.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/tui/tui.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index d4b34e82f8..399d6c74ca 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -1016,9 +1016,11 @@ static void fix_terminfo(TUIData *data)
"\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"
if ((colorterm && strstr(colorterm, "256"))
+ || STARTS_WITH(term, "linux")
|| strstr(term, "256")
|| strstr(term, "xterm")) {
- // Assume TERM=~xterm or COLORTERM=~256 supports 256 colors.
+ // Linux 4.8+ supports 256-color SGR, but terminfo has 8-color setaf/setab.
+ // Assume TERM=~xterm|linux or COLORTERM=~256 supports 256 colors.
unibi_set_num(ut, unibi_max_colors, 256);
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF);
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB);