Skip to content

Commit dd721b6

Browse files
committed
test: set 'termguicolors' for every child process
Details: - This seems to make testing more robust. Not in the last because 'mini.hues' defines only `gui{fg,bg,sp}` highlight attributes. - The driver for this change was PR number 35026 on neovim/neovim. It adjusted how highlight groups linked to `Normal` are not displayed over `CursorLine`. This is a good change, but introduced an issue with `child.fn.screenattr()` output. It seems to started to ignore not only `linked to Normal` groups, but at least some others (like `linked to NormalFloat`, which has different background than `Normal`). The visible side effect here was that current line in 'mini.files' explorer (which has cursorline enabled) was shown with a single highlight from start to finish where two (from `content.highlight` and `CursorLine`) was expected. Two expected groups have visibly different background when tried to reproduce interactively. What seems to be the culprit is that Neovim's C code in this case now acts differently based on the output of `ui_rgb_attached()`. Child processes do not have an attached UI that explicitly says that it supports `rgb`. Nor there is an explicit 'termguicolors'. Explicitly enabling 'termguicolors' fixes the 'mini.files' test.
1 parent 0abb662 commit dd721b6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

scripts/minimal_init.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ end
1717

1818
-- Ensure no custom fold method in Lua files (it interfers with many tests)
1919
vim.cmd('au FileType lua set foldmethod=manual')
20+
21+
-- - Ensure that child process is tested with termguicolors, since 'mini.hues'
22+
-- only works with it. This might matter with screenshot testing.
23+
-- One example is how https://github.com/neovim/neovim/pull/35026 adjusts
24+
-- the behavior based on the presence of `rgb`.
25+
-- NOTE: similar effect can be achieved by adding the following to
26+
-- `child.setup` in 'helpers.lua':
27+
-- `child.api.nvim_ui_attach(child.o.columns, child.o.lines, { rgb=true })`
28+
vim.o.termguicolors = true

tests/test_basics.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ T['Options'] = new_set()
148148
T['Options']['work'] = function()
149149
-- Basic options (should be set by default)
150150
eq(child.g.mapleader, vim.NIL)
151-
-- - `termguicolors` is enabled in Neovim=0.10 by default (if possible)
152-
if child.fn.has('nvim-0.10') == 0 then eq(child.o.termguicolors, false) end
153151
eq(child.o.number, false)
154152
eq(child.o.signcolumn, 'auto')
155153
eq(child.o.fillchars, '')
@@ -160,7 +158,6 @@ T['Options']['work'] = function()
160158
load_module()
161159

162160
eq(child.g.mapleader, ' ')
163-
if child.fn.has('nvim-0.10') == 0 then eq(child.o.termguicolors, true) end
164161
eq(child.o.number, true)
165162
eq(child.o.signcolumn, 'yes')
166163
eq(child.o.fillchars, 'eob: ')

0 commit comments

Comments
 (0)