Skip to content

Commit

Permalink
fix(menu-scrollbar): scrollbar not at bottom when last line is shown …
Browse files Browse the repository at this point in the history
…(partially fix #93)
  • Loading branch information
bekaboo committed Sep 27, 2023
1 parent b4b6b4a commit dc11786
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lua/dropbar/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,12 @@ function dropbar_menu_t:update_scrollbar()
return
end

local topline = vim.fn.line('w0')
local thumb_height = math.max(1, math.floor(win_height ^ 2 / buf_height))
local offset = math.min(
win_height - thumb_height,
math.floor(win_height * topline / buf_height)
)
local offset = vim.fn.line('w$') == buf_height and win_height - thumb_height
or math.min(
win_height - thumb_height,
math.floor(win_height * vim.fn.line('w0') / buf_height)
)

if self.scrollbar and vim.api.nvim_win_is_valid(self.scrollbar.thumb) then
local config = vim.api.nvim_win_get_config(self.scrollbar.thumb)
Expand Down

0 comments on commit dc11786

Please sign in to comment.