fix(#2859): make sure window still exists when restoring options (#2863)

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Michael Härtl 2024-08-10 04:21:48 +02:00 committed by GitHub
parent 15942df2bb
commit 466fbed3e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,6 +167,8 @@ local function pick_win_id()
if laststatus == 3 then if laststatus == 3 then
for _, id in ipairs(not_selectable) do for _, id in ipairs(not_selectable) do
-- Ensure window still exists at this point
if vim.api.nvim_win_is_valid(id) then
for opt, value in pairs(win_opts[id]) do for opt, value in pairs(win_opts[id]) do
if vim.fn.has "nvim-0.10" == 1 then if vim.fn.has "nvim-0.10" == 1 then
vim.api.nvim_set_option_value(opt, value, { win = id }) vim.api.nvim_set_option_value(opt, value, { win = id })
@ -176,6 +178,7 @@ local function pick_win_id()
end end
end end
end end
end
vim.o.laststatus = laststatus vim.o.laststatus = laststatus