Skip to content

Commit 0d7d546

Browse files
authored
Merge pull request #259 from demopath/main
fix: neominimap boundary line issue
2 parents 9c54324 + 42e9e73 commit 0d7d546

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/neominimap/window/util.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ local function set_current_line_by_percentage(winid, row)
8585
local win_h = M.win_get_true_height(winid)
8686
local bufnr = api.nvim_win_get_buf(winid)
8787
local line_cnt = api.nvim_buf_line_count(bufnr)
88-
local topline = math.floor(row - (row * win_h) / line_cnt)
88+
local topline = math.floor(row - (row * win_h) / line_cnt) + 1
8989
row = math.max(1, math.min(row, line_cnt))
9090
topline = math.max(1, math.min(topline, line_cnt))
9191
return function()
9292
local view = vim.fn.winsaveview()
9393
view.topline = topline
94-
view.lnum = row - 1
94+
view.lnum = row
9595
vim.fn.winrestview(view)
9696
end
9797
end

0 commit comments

Comments
 (0)