Skip to content

Commit

Permalink
fix(animate): prefer topline to be the max instead of min
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jul 15, 2024
1 parent 62333b9 commit 0e8bbab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/edgy/animate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ function M.animate(step)
local topline_min = math.max(view.lnum - height + 1, 1)
local topline_max = view.lnum
local topline = math.min(topline_max, math.max(topline_min, M.state[win].view.topline))
if topline > height then
topline = topline_max
end
vim.fn.winrestview({ lnum = view.lnum, topline = topline })
end)
end
Expand Down

0 comments on commit 0e8bbab

Please sign in to comment.