tui: Add st to the always 256-colour capable list.

Also comment and augment some terminal colour tests.
This commit is contained in:
Jonathan de Boyne Pollard
2017-05-28 12:18:01 +01:00
parent 3f8dedd7ae
commit 5377de33ac
2 changed files with 38 additions and 13 deletions

View File

@@ -2459,7 +2459,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
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 for
// more on this. // more on this.
if (konsole || mate || xterm || gnome || rxvt if (konsole || mate || xterm || gnome || rxvt || st
|| linuxvt // Linux 4.8+ supports 256-colour SGR. || linuxvt // Linux 4.8+ supports 256-colour SGR.
|| (colorterm && strstr(colorterm, "256")) || (colorterm && strstr(colorterm, "256"))
|| (term && strstr(term, "256")) || (term && strstr(term, "256"))

View File

@@ -399,7 +399,15 @@ describe("tui 't_Co' (terminal colors)", function()
assert_term_colors("linux-16color", nil, 256) assert_term_colors("linux-16color", nil, 256)
end) end)
it("TERM=linux-256color uses 256 colors", function()
assert_term_colors("linux-256color", nil, 256)
end)
-- screen and tmux: -- 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() it("TERM=screen no COLORTERM uses 8/256 colors", function()
if is_freebsd then if is_freebsd then
@@ -460,35 +468,48 @@ describe("tui 't_Co' (terminal colors)", function()
end) end)
-- rxvt and stterm: -- 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() it("TERM=rxvt no COLORTERM uses 256 colors", function()
assert_term_colors("rxvt", nil, 256) assert_term_colors("rxvt", nil, 256)
end) 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() it("TERM=rxvt-256color uses 256 colors", function()
assert_term_colors("rxvt-256color", nil, 256) assert_term_colors("rxvt-256color", nil, 256)
end) end)
it("TERM=st no COLORTERM uses 8/256 colors", function() it("TERM=st no COLORTERM uses 256 colors", function()
if is_freebsd then
assert_term_colors("st", nil, 256) assert_term_colors("st", nil, 256)
else
assert_term_colors("st", nil, 8)
end
end) end)
it("TERM=st COLORTERM=st uses 16/256 colors", function() it("TERM=st COLORTERM=st uses 256 colors", function()
if is_freebsd then
assert_term_colors("st", "st", 256) assert_term_colors("st", "st", 256)
else
assert_term_colors("st", "st", 16)
end
end) end)
it("TERM=st COLORTERM=st-256color uses 256 colors", function() it("TERM=st COLORTERM=st-256color uses 256 colors", function()
assert_term_colors("st", "st-256color", 256) assert_term_colors("st", "st-256color", 256)
end) 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() it("TERM=st-256color uses 256 colors", function()
assert_term_colors("st-256color", nil, 256) assert_term_colors("st-256color", nil, 256)
end) end)
@@ -499,6 +520,10 @@ describe("tui 't_Co' (terminal colors)", function()
assert_term_colors("interix", nil, 8) assert_term_colors("interix", nil, 8)
end) end)
it("TERM=iTerm.app uses 256 colors", function()
assert_term_colors("iTerm.app", nil, 256)
end)
it("TERM=iterm uses 256 colors", function() it("TERM=iterm uses 256 colors", function()
assert_term_colors("iterm", nil, 256) assert_term_colors("iterm", nil, 256)
end) end)