fix(picker.colorscheme): nil check. Fixes #575

This commit is contained in:
Folke Lemaitre 2025-01-17 10:03:39 +01:00
parent 559ab72696
commit de01907930
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -250,10 +250,10 @@ function M.colorscheme(ctx)
ctx.preview.state.colorscheme = vim.g.colors_name or "default"
ctx.preview.state.background = vim.o.background
ctx.preview.win:on("WinClosed", function()
if not ctx.preview.state.colorscheme then
return
end
vim.schedule(function()
if not ctx.preview.state.colorscheme then
return
end
vim.cmd("colorscheme " .. ctx.preview.state.colorscheme)
vim.o.background = ctx.preview.state.background
end)