Skip to content

Commit

Permalink
fix(#2859): make sure window still exists when restoring options (#2863)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Courtis <[email protected]>
  • Loading branch information
mikehaertl and alex-courtis authored Aug 10, 2024
1 parent 15942df commit 466fbed
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lua/nvim-tree/actions/node/open-file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,14 @@ local function pick_win_id()

if laststatus == 3 then
for _, id in ipairs(not_selectable) do
for opt, value in pairs(win_opts[id]) do
if vim.fn.has "nvim-0.10" == 1 then
vim.api.nvim_set_option_value(opt, value, { win = id })
else
vim.api.nvim_win_set_option(id, opt, value) ---@diagnostic disable-line: deprecated
-- 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
if vim.fn.has "nvim-0.10" == 1 then
vim.api.nvim_set_option_value(opt, value, { win = id })
else
vim.api.nvim_win_set_option(id, opt, value) ---@diagnostic disable-line: deprecated
end
end
end
end
Expand Down

0 comments on commit 466fbed

Please sign in to comment.