@@ -45,9 +45,55 @@ endfunction
45
45
if has (' nvim' )
46
46
function ! s: info (winid) abort
47
47
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
+
48
92
return {
49
93
\ ' width' : l: info .width,
50
94
\ ' height' : l: info .height,
95
+ \ ' core_width' : l: info .core_width,
96
+ \ ' core_height' : l: info .core_height,
51
97
\ ' topline' : l: info .topline,
52
98
\ }
53
99
endfunction
58
104
return {
59
105
\ ' width' : l: info .width,
60
106
\ ' height' : l: info .height,
107
+ \ ' core_width' : l: info .core_width,
108
+ \ ' core_height' : l: info .core_height,
61
109
\ ' topline' : l: info .firstline
62
110
\ }
63
111
endif
67
115
function ! l: ctx .callback () abort
68
116
let self .info.width = winwidth (0 )
69
117
let self .info.height = winheight (0 )
118
+ let self .info.core_width = self .info.width
119
+ let self .info.core_height = self .info.height
70
120
let self .info.topline = line (' w0' )
71
121
endfunction
72
122
call s: do (a: winid , { - > l: ctx .callback () })
@@ -106,7 +156,7 @@ function! s:scroll(winid, topline) abort
106
156
function ! l: ctx .callback (winid, topline) abort
107
157
let l: wininfo = s: info (a: winid )
108
158
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 ])
110
160
let l: topline = max ([l: topline , 1 ])
111
161
112
162
if l: topline == l: wininfo .topline
0 commit comments