fix(ui): disable backdrop when Neovim is transparent

This commit is contained in:
Folke Lemaitre 2024-03-28 14:52:05 +01:00
parent ba58b87ed9
commit 0ccf031227
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 4 additions and 1 deletions

View File

@ -131,7 +131,10 @@ function M:mount()
self.buf = vim.api.nvim_create_buf(false, true)
end
if self.opts.backdrop and self.opts.backdrop < 100 and vim.o.termguicolors then
local normal = vim.api.nvim_get_hl(0, { name = "Normal" })
local has_bg = normal and normal.bg ~= nil
if has_bg and self.opts.backdrop and self.opts.backdrop < 100 and vim.o.termguicolors then
self.backdrop_buf = vim.api.nvim_create_buf(false, true)
self.backdrop_win = vim.api.nvim_open_win(self.backdrop_buf, false, {
relative = "editor",