Skip to content

Commit fadf015

Browse files
authored
fix: invalid window id during restoring windows (#89)
Fixed #88
1 parent c9647c2 commit fadf015

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lua/window-picker/hints/statusline-winbar-hint.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ end
145145

146146
function M:restore_win_opts()
147147
for index, opt in ipairs(self.opt_save.w) do
148-
vim.wo[opt.window][opt.name] = opt.value
148+
if vim.api.nvim_win_is_valid(opt.window) then
149+
vim.wo[opt.window][opt.name] = opt.value
150+
end
149151
self.opt_save.w[index] = nil
150152
end
151153
end
@@ -232,7 +234,9 @@ end
232234

233235
function M:restore_win_hl()
234236
for _, window in ipairs(self.hl_ns_save) do
235-
vim.api.nvim_win_set_hl_ns(window, 0)
237+
if vim.api.nvim_win_is_valid(window) then
238+
vim.api.nvim_win_set_hl_ns(window, 0)
239+
end
236240
end
237241
end
238242

0 commit comments

Comments
 (0)