aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/terminal/tui_spec.lua55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index efa65b7441..80df336cc4 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -2939,6 +2939,61 @@ describe('TUI', function()
end)
end)
+ it('does not query the terminal for truecolor support if $COLORTERM is set', function()
+ clear()
+ exec_lua([[
+ vim.api.nvim_create_autocmd('TermRequest', {
+ callback = function(args)
+ local req = args.data
+ vim.g.termrequest = req
+ local xtgettcap = req:match('^\027P%+q([%x;]+)$')
+ if xtgettcap then
+ local t = {}
+ for cap in vim.gsplit(xtgettcap, ';') do
+ local resp = string.format('\027P1+r%s\027\\', xtgettcap)
+ vim.api.nvim_chan_send(vim.bo[args.buf].channel, resp)
+ t[vim.text.hexdecode(cap)] = true
+ end
+ vim.g.xtgettcap = t
+ return true
+ elseif req:match('^\027P$qm\027\\$') then
+ vim.g.decrqss = true
+ end
+ end,
+ })
+ ]])
+
+ local child_server = new_pipename()
+ screen = tt.setup_child_nvim({
+ '--listen',
+ child_server,
+ '-u',
+ 'NONE',
+ '-i',
+ 'NONE',
+ }, {
+ env = {
+ VIMRUNTIME = os.getenv('VIMRUNTIME'),
+ -- With COLORTERM=256, Nvim should not query the terminal and should not set 'tgc'
+ COLORTERM = '256',
+ TERM = 'xterm-256colors',
+ },
+ })
+
+ screen:expect({ any = '%[No Name%]' })
+
+ local child_session = n.connect(child_server)
+ retry(nil, 1000, function()
+ local xtgettcap = eval("get(g:, 'xtgettcap', {})")
+ eq(nil, xtgettcap['Tc'])
+ eq(nil, xtgettcap['RGB'])
+ eq(nil, xtgettcap['setrgbf'])
+ eq(nil, xtgettcap['setrgbb'])
+ eq(0, eval([[get(g:, 'decrqss')]]))
+ eq({ true, 0 }, { child_session:request('nvim_eval', '&termguicolors') })
+ end)
+ end)
+
it('queries the terminal for OSC 52 support', function()
clear()
exec_lua([[