fix(highlight): skip blending when Normal.bg is nil (transparent)
Problem: colorschemes with `transparent_mode = true` set Normal with no bg. `compute_highlight_groups` fell back to `0x1a1a1a` and blended all highlight groups against it, producing wrong colors. The `ColorScheme` autocmd also failed to overwrite stale values because every `nvim_set_hl` call used `default = true`. Solution: detect transparent Normal via `not normal.bg`. When transparent, pass `bg = normal.bg` (nil) to `DiffsClear` and use colorscheme DiffAdd/DiffDelete colors directly without blending. Reset `hl_retry_pending` on `ColorScheme` so the retry mechanism re-arms after a theme switch.
This commit is contained in:
parent
2097ef802c
commit
6d38472b39
2 changed files with 46 additions and 19 deletions
|
|
@ -554,7 +554,7 @@ describe('diffs', function()
|
|||
diffs._test.set_hl_retry_pending(false)
|
||||
end)
|
||||
|
||||
it('sets DiffsClear.bg to a number when Normal.bg is nil', function()
|
||||
it('omits DiffsClear.bg when Normal.bg is nil (transparent)', function()
|
||||
vim.api.nvim_get_hl = function(ns, opts)
|
||||
if opts.name == 'Normal' then
|
||||
return { fg = 0xc0c0c0 }
|
||||
|
|
@ -562,7 +562,7 @@ describe('diffs', function()
|
|||
return saved_get_hl(ns, opts)
|
||||
end
|
||||
diffs._test.compute_highlight_groups()
|
||||
assert.is_number(set_calls.DiffsClear.bg)
|
||||
assert.is_nil(set_calls.DiffsClear.bg)
|
||||
assert.is_table(set_calls.DiffsAdd)
|
||||
assert.is_table(set_calls.DiffsDelete)
|
||||
end)
|
||||
|
|
@ -596,7 +596,7 @@ describe('diffs', function()
|
|||
diffs._test.compute_highlight_groups()
|
||||
assert.are.equal(1, #schedule_cbs)
|
||||
schedule_cbs[1]()
|
||||
assert.is_number(set_calls.DiffsClear.bg)
|
||||
assert.are.equal(0x1e1e2e, set_calls.DiffsClear.bg)
|
||||
assert.are.equal(1, #schedule_cbs)
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue