1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 04:00:04 +08:00

fix(scrollbar): fix position of scrollbar

This commit is contained in:
wsdjeg 2022-04-21 13:14:45 +08:00
parent 0b3f505e4d
commit a98061caad

View File

@ -131,13 +131,13 @@ function! SpaceVim#plugins#scrollbar#show() abort
return return
endif endif
let pos = getpos('.') " the position should be based on first line of current screen.
let curr_line = pos[1] let curr_line = line('w0')
let bar_size = s:fix_size(height * height / total) let bar_size = s:fix_size(height * height / total)
let width = winwidth(winnr) let width = winwidth(winnr)
let col = width - s:get('width') - s:get('right_offset') let col = width - s:get('width') - s:get('right_offset')
let row = (height - bar_size) * (curr_line * 1.0 / total) let row = (height - bar_size) * (curr_line * 1.0 / (total - height))
let opts = { let opts = {
\ 'style' : 'minimal', \ 'style' : 'minimal',
@ -176,4 +176,3 @@ function! SpaceVim#plugins#scrollbar#clear(...) abort
call s:FLOAT.win_close(s:scrollbar_winid, 1) call s:FLOAT.win_close(s:scrollbar_winid, 1)
endif endif
endfunction endfunction