Skip to content

Commit

Permalink
fix: scrollbar destructs itself, so make a copy to see if there are a…
Browse files Browse the repository at this point in the history
…ny remnants left
  • Loading branch information
folke committed Dec 3, 2022
1 parent 4c34232 commit 8d80a69
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lua/noice/view/scrollbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,17 @@ end
function Scrollbar:hide()
if self.visible then
self.visible = false
if self.bar then
pcall(vim.api.nvim_buf_delete, self.bar.bufnr, { force = true })
pcall(vim.api.nvim_win_close, self.bar.winnr, true)
local bar = self.bar
if bar then
pcall(vim.api.nvim_buf_delete, bar.bufnr, { force = true })
pcall(vim.api.nvim_win_close, bar.winnr, true)
self.bar = nil
end

if self.thumb then
pcall(vim.api.nvim_buf_delete, self.thumb.bufnr, { force = true })
pcall(vim.api.nvim_win_close, self.thumb.winnr, true)
local thumb = self.thumb
if thumb then
pcall(vim.api.nvim_buf_delete, thumb.bufnr, { force = true })
pcall(vim.api.nvim_win_close, thumb.winnr, true)
self.thumb = nil
end
end
Expand Down

0 comments on commit 8d80a69

Please sign in to comment.