Skip to content

Commit 24234f4

Browse files
authored
fix(ui): add conditional nvim_get_hl_by_name for Neovim 0.8.0 (#1429)
1 parent 3f13f08 commit 24234f4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lua/lazy/view/float.lua

+8-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,14 @@ function M:mount()
131131
self.buf = vim.api.nvim_create_buf(false, true)
132132
end
133133

134-
local normal = vim.api.nvim_get_hl(0, { name = "Normal" })
135-
local has_bg = normal and normal.bg ~= nil
134+
local normal, has_bg
135+
if vim.fn.has("nvim-0.9.0") == 0 then
136+
normal = vim.api.nvim_get_hl_by_name("Normal", true)
137+
has_bg = normal and normal.background ~= nil
138+
else
139+
normal = vim.api.nvim_get_hl(0, { name = "Normal" })
140+
has_bg = normal and normal.bg ~= nil
141+
end
136142

137143
if has_bg and self.opts.backdrop and self.opts.backdrop < 100 and vim.o.termguicolors then
138144
self.backdrop_buf = vim.api.nvim_create_buf(false, true)

0 commit comments

Comments
 (0)