aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com>2017-05-28 12:18:01 +0100
committerJonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com>2017-06-03 18:53:28 +0100
commit5377de33ac4adea54c9c9980c7a6bc8cc70c0c7a (patch)
treeeaec5a1aa5e6fca97941feb89a81212212b8d010
parent3f8dedd7aefaa64cea83add75715701b50625812 (diff)
downloadrneovim-5377de33ac4adea54c9c9980c7a6bc8cc70c0c7a.tar.gz
rneovim-5377de33ac4adea54c9c9980c7a6bc8cc70c0c7a.tar.bz2
rneovim-5377de33ac4adea54c9c9980c7a6bc8cc70c0c7a.zip
tui: Add st to the always 256-colour capable list.
Also comment and augment some terminal colour tests.
-rw-r--r--src/nvim/tui/tui.c2
-rw-r--r--test/functional/terminal/tui_spec.lua49
2 files changed, 38 insertions, 13 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 3d27758b01..5ea46c5ab7 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -2459,7 +2459,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
if (unibi_get_num(ut, unibi_max_colors) < 256) {
// See http://fedoraproject.org/wiki/Features/256_Color_Terminals for
// more on this.
- if (konsole || mate || xterm || gnome || rxvt
+ if (konsole || mate || xterm || gnome || rxvt || st
|| linuxvt // Linux 4.8+ supports 256-colour SGR.
|| (colorterm && strstr(colorterm, "256"))
|| (term && strstr(term, "256"))
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index ac30be1e58..225a1fc170 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -399,7 +399,15 @@ describe("tui 't_Co' (terminal colors)", function()
assert_term_colors("linux-16color", nil, 256)
end)
+ it("TERM=linux-256color uses 256 colors", function()
+ assert_term_colors("linux-256color", nil, 256)
+ end)
+
-- screen and tmux:
+ --
+ -- FreeBSD falls back to the built-in screen-256colour entry.
+ -- Linux and MacOS have a screen entry in external terminfo with 8 colours,
+ -- which is raised to 16 by COLORTERM.
it("TERM=screen no COLORTERM uses 8/256 colors", function()
if is_freebsd then
@@ -460,35 +468,48 @@ describe("tui 't_Co' (terminal colors)", function()
end)
-- rxvt and stterm:
+ --
+ -- FreeBSD and MacOS fall back to the built-in rxvt-256color and
+ -- st-256colour entries.
+ -- Linux has an rxvt, an st, and an st-16color entry in external terminfo
+ -- with 8, 8, and 16 colours respectively, which are raised to 256.
it("TERM=rxvt no COLORTERM uses 256 colors", function()
assert_term_colors("rxvt", nil, 256)
end)
+ it("TERM=rxvt COLORTERM=rxvt uses 256 colors", function()
+ assert_term_colors("rxvt", "rxvt", 256)
+ end)
+
it("TERM=rxvt-256color uses 256 colors", function()
assert_term_colors("rxvt-256color", nil, 256)
end)
- it("TERM=st no COLORTERM uses 8/256 colors", function()
- if is_freebsd then
- assert_term_colors("st", nil, 256)
- else
- assert_term_colors("st", nil, 8)
- end
+ it("TERM=st no COLORTERM uses 256 colors", function()
+ assert_term_colors("st", nil, 256)
end)
- it("TERM=st COLORTERM=st uses 16/256 colors", function()
- if is_freebsd then
- assert_term_colors("st", "st", 256)
- else
- assert_term_colors("st", "st", 16)
- end
+ it("TERM=st COLORTERM=st uses 256 colors", function()
+ assert_term_colors("st", "st", 256)
end)
it("TERM=st COLORTERM=st-256color uses 256 colors", function()
assert_term_colors("st", "st-256color", 256)
end)
+ it("TERM=st-16color no COLORTERM uses 8/256 colors", function()
+ assert_term_colors("st", nil, 256)
+ end)
+
+ it("TERM=st-16color COLORTERM=st uses 16/256 colors", function()
+ assert_term_colors("st", "st", 256)
+ end)
+
+ it("TERM=st-16color COLORTERM=st-256color uses 256 colors", function()
+ assert_term_colors("st", "st-256color", 256)
+ end)
+
it("TERM=st-256color uses 256 colors", function()
assert_term_colors("st-256color", nil, 256)
end)
@@ -499,6 +520,10 @@ describe("tui 't_Co' (terminal colors)", function()
assert_term_colors("interix", nil, 8)
end)
+ it("TERM=iTerm.app uses 256 colors", function()
+ assert_term_colors("iTerm.app", nil, 256)
+ end)
+
it("TERM=iterm uses 256 colors", function()
assert_term_colors("iterm", nil, 256)
end)