Skip to content

Commit

Permalink
fix(scrollbar): use cursorline to determine thumb position (#267)
Browse files Browse the repository at this point in the history
Problem: The scrollbar doesn't touch the bottom of the window when scrolled to the bottom of the list.
Solution: Use the cursorline for positioning the thumb instead of topline
  • Loading branch information
willothy authored Nov 5, 2024
1 parent e6c735b commit 28fcf95
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lua/blink/cmp/windows/lib/scrollbar/geometry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ function M.get_geometry(target_win)

local thumb_height = math.max(1, math.floor(height * height / buf_height + 0.5) - 1)

local start_line = math.max(1, vim.fn.line('w0', target_win) - 1)
local pct = (start_line - 1) / buf_height
local thumb_offset = math.ceil(pct * (height - thumb_height))
local start_line = math.max(1, vim.fn.line('w0', target_win))

local pct = (start_line - 1) / (buf_height - height)

local thumb_offset = math.floor((pct * (height - thumb_height)) + 0.5)

local common_geometry = {
width = 1,
Expand Down

0 comments on commit 28fcf95

Please sign in to comment.