Skip to content

Commit

Permalink
fix(ui): add conditional nvim_get_hl_by_name for Neovim 0.8.0 (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpetka2001 committed May 4, 2024
1 parent 3f13f08 commit 24234f4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lua/lazy/view/float.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,14 @@ function M:mount()
self.buf = vim.api.nvim_create_buf(false, true)
end

local normal = vim.api.nvim_get_hl(0, { name = "Normal" })
local has_bg = normal and normal.bg ~= nil
local normal, has_bg
if vim.fn.has("nvim-0.9.0") == 0 then
normal = vim.api.nvim_get_hl_by_name("Normal", true)
has_bg = normal and normal.background ~= nil
else
normal = vim.api.nvim_get_hl(0, { name = "Normal" })
has_bg = normal and normal.bg ~= nil
end

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)
Expand Down

0 comments on commit 24234f4

Please sign in to comment.