Skip to content

Commit 28fcf95

Browse files
authored
fix(scrollbar): use cursorline to determine thumb position (#267)
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
1 parent e6c735b commit 28fcf95

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/blink/cmp/windows/lib/scrollbar/geometry.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ function M.get_geometry(target_win)
3939

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

42-
local start_line = math.max(1, vim.fn.line('w0', target_win) - 1)
43-
local pct = (start_line - 1) / buf_height
44-
local thumb_offset = math.ceil(pct * (height - thumb_height))
42+
local start_line = math.max(1, vim.fn.line('w0', target_win))
43+
44+
local pct = (start_line - 1) / (buf_height - height)
45+
46+
local thumb_offset = math.floor((pct * (height - thumb_height)) + 0.5)
4547

4648
local common_geometry = {
4749
width = 1,

0 commit comments

Comments
 (0)