@@ -45,9 +45,55 @@ endfunction
4545if 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
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
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
0 commit comments