Skip to content

Commit c544ccd

Browse files
committed
Update vital-vs for fixing to scroll bordererd-window
1 parent f7ccf00 commit c544ccd

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

autoload/vital/_lsp/VS/Vim/Window.vim

+51-1
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,55 @@ endfunction
4545
if has('nvim')
4646
function! s:info(winid) abort
4747
let l:info = getwininfo(a:winid)[0]
48+
49+
if s:is_floating(a:winid)
50+
let l:config = nvim_win_get_config(a:winid)
51+
let l:config.border = get(l:config, 'border', 'none')
52+
if type(l:config.border) !=# type([])
53+
if index(['rounded', 'single', 'double', 'solid'], l:config.border) >= 0
54+
let l:width_off = 2
55+
let l:height_off = 2
56+
elseif l:config.border ==# 'shadow'
57+
let l:width_off = 1
58+
let l:height_off = 1
59+
else
60+
let l:width_off = 0
61+
let l:height_off = 0
62+
endif
63+
else
64+
let l:has_top = v:false
65+
let l:has_top = l:has_top || get(l:config.border, 0, '') !=# ''
66+
let l:has_top = l:has_top || get(l:config.border, 1, '') !=# ''
67+
let l:has_top = l:has_top || get(l:config.border, 2, '') !=# ''
68+
let l:has_right = v:false
69+
let l:has_right = l:has_right || get(l:config.border, 2, '') !=# ''
70+
let l:has_right = l:has_right || get(l:config.border, 3, '') !=# ''
71+
let l:has_right = l:has_right || get(l:config.border, 4, '') !=# ''
72+
let l:has_bottom = v:false
73+
let l:has_bottom = l:has_bottom || get(l:config.border, 4, '') !=# ''
74+
let l:has_bottom = l:has_bottom || get(l:config.border, 5, '') !=# ''
75+
let l:has_bottom = l:has_bottom || get(l:config.border, 6, '') !=# ''
76+
let l:has_left = v:false
77+
let l:has_left = l:has_left || get(l:config.border, 6, '') !=# ''
78+
let l:has_left = l:has_left || get(l:config.border, 7, '') !=# ''
79+
let l:has_left = l:has_left || get(l:config.border, 0, '') !=# ''
80+
81+
let l:width_off = (l:has_left ? 1 : 0) + (l:has_right ? 1 : 0)
82+
let l:height_off = (l:has_top ? 1 : 0) + (l:has_bottom ? 1 : 0)
83+
endif
84+
let l:left = get(l:config, '')
85+
let l:info.core_width = l:config.width - l:width_off
86+
let l:info.core_height = l:config.height - l:height_off
87+
else
88+
let l:info.core_width = l:info.width
89+
let l:info.core_height = l:info.height
90+
endif
91+
4892
return {
4993
\ 'width': l:info.width,
5094
\ 'height': l:info.height,
95+
\ 'core_width': l:info.core_width,
96+
\ 'core_height': l:info.core_height,
5197
\ 'topline': l:info.topline,
5298
\ }
5399
endfunction
@@ -58,6 +104,8 @@ else
58104
return {
59105
\ 'width': l:info.width,
60106
\ 'height': l:info.height,
107+
\ 'core_width': l:info.core_width,
108+
\ 'core_height': l:info.core_height,
61109
\ 'topline': l:info.firstline
62110
\ }
63111
endif
@@ -67,6 +115,8 @@ else
67115
function! l:ctx.callback() abort
68116
let self.info.width = winwidth(0)
69117
let self.info.height = winheight(0)
118+
let self.info.core_width = self.info.width
119+
let self.info.core_height = self.info.height
70120
let self.info.topline = line('w0')
71121
endfunction
72122
call s:do(a:winid, { -> l:ctx.callback() })
@@ -106,7 +156,7 @@ function! s:scroll(winid, topline) abort
106156
function! l:ctx.callback(winid, topline) abort
107157
let l:wininfo = s:info(a:winid)
108158
let l:topline = a:topline
109-
let l:topline = min([l:topline, line('$') - l:wininfo.height + 1])
159+
let l:topline = min([l:topline, line('$') - l:wininfo.core_height + 1])
110160
let l:topline = max([l:topline, 1])
111161

112162
if l:topline == l:wininfo.topline

autoload/vital/lsp.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ endfunction
218218
" @vimlint(EVL102, 0, l:__)
219219
" @vimlint(EVL102, 0, l:_)
220220

221-
" s:_get_module() returns module object wihch has all script local functions.
221+
" s:_get_module() returns module object which has all script local functions.
222222
function! s:_get_module(name) abort dict
223223
let funcname = s:_import_func_name(self.plugin_name(), a:name)
224224
try

autoload/vital/lsp.vital

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
lsp
2-
b1e91b41f5028d65fa3d31a425ff21591d5d957f
2+
969a97cb6b3e634490ba168db0f2606c410cf9a7
33

44
VS.LSP.MarkupContent
5-
VS.Vim.Window.FloatingWindow
6-
VS.Vim.Syntax.Markdown
5+
VS.LSP.Text
76
VS.Vim.Buffer
7+
VS.Vim.Syntax.Markdown
88
VS.Vim.Window
9+
VS.Vim.Window.FloatingWindow

0 commit comments

Comments
 (0)