Skip to content

Commit 8d80a69

Browse files
committed
fix: scrollbar destructs itself, so make a copy to see if there are any remnants left
1 parent 4c34232 commit 8d80a69

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lua/noice/view/scrollbar.lua

+8-6
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,17 @@ end
6767
function Scrollbar:hide()
6868
if self.visible then
6969
self.visible = false
70-
if self.bar then
71-
pcall(vim.api.nvim_buf_delete, self.bar.bufnr, { force = true })
72-
pcall(vim.api.nvim_win_close, self.bar.winnr, true)
70+
local bar = self.bar
71+
if bar then
72+
pcall(vim.api.nvim_buf_delete, bar.bufnr, { force = true })
73+
pcall(vim.api.nvim_win_close, bar.winnr, true)
7374
self.bar = nil
7475
end
7576

76-
if self.thumb then
77-
pcall(vim.api.nvim_buf_delete, self.thumb.bufnr, { force = true })
78-
pcall(vim.api.nvim_win_close, self.thumb.winnr, true)
77+
local thumb = self.thumb
78+
if thumb then
79+
pcall(vim.api.nvim_buf_delete, thumb.bufnr, { force = true })
80+
pcall(vim.api.nvim_win_close, thumb.winnr, true)
7981
self.thumb = nil
8082
end
8183
end

0 commit comments

Comments
 (0)