Skip to content

Commit

Permalink
fix(previewer): debounce preview scroll spam (#1568)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Dec 14, 2024
1 parent 9568a38 commit a5e56a5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/fzf-lua/previewer/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,18 @@ function Previewer.base:preview_window(_)
end

function Previewer.base:scroll(direction)
vim.defer_fn(function()
if self._scrolling then
utils.info(string.format("skip %s", direction))
return
end
self._scrolling = true
self:_scroll(direction)
self._scrolling = nil
end, 0)
end

function Previewer.base:_scroll(direction)
local preview_winid = self.win.preview_winid
if preview_winid < 0 or not direction then return end
if not api.nvim_win_is_valid(preview_winid) then return end
Expand Down

0 comments on commit a5e56a5

Please sign in to comment.