Skip to content

Commit

Permalink
fix: silently close window
Browse files Browse the repository at this point in the history
  • Loading branch information
XuYuan Pang committed Nov 28, 2024
1 parent d7e6966 commit a399fc9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lua/scrollbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ end

function M.clear(_, bufnr)
bufnr = bufnr or 0
local state = buf_get_var(bufnr, 'scrollbar_state')
if state and state.winnr then
local state = vim.b[bufnr].scrollbar_state
if state and state.winnr and api.nvim_win_is_valid(state.winnr) then
api.nvim_win_close(state.winnr, true)
api.nvim_buf_set_var(bufnr, 'scrollbar_state', {
vim.b[bufnr].scrollbar_state = {
size = state.size,
bufnr = state.bufnr,
})
}
end
end

Expand Down

0 comments on commit a399fc9

Please sign in to comment.