@@ -57,7 +57,9 @@ function win.new(config)
57
57
}
58
58
59
59
if self .config .scrollbar then
60
- self .scrollbar = require (' blink.cmp.windows.lib.scrollbar' ).new ({ enable_gutter = self .config .border == ' none' })
60
+ self .scrollbar = require (' blink.cmp.windows.lib.scrollbar' ).new ({
61
+ enable_gutter = self .config .border == ' none' or self .config .border == ' padded' ,
62
+ })
61
63
end
62
64
63
65
return self
@@ -149,19 +151,24 @@ end
149
151
function win :get_border_size ()
150
152
if not self :is_open () then return { vertical = 0 , horizontal = 0 , left = 0 , right = 0 , top = 0 , bottom = 0 } end
151
153
154
+ local left = 0
155
+ local right = 0
156
+ local top = 0
157
+ local bottom = 0
158
+
152
159
local border = self .config .border
153
- if border == ' none' then
154
- if self .scrollbar and self .scrollbar :is_visible () then
155
- return { vertical = 0 , horizontal = 1 , left = 0 , right = 1 , top = 0 , bottom = 0 }
156
- end
157
- return { vertical = 0 , horizontal = 0 , left = 0 , right = 0 , top = 0 , bottom = 0 }
158
- elseif border == ' padded' then
159
- return { vertical = 0 , horizontal = 2 , left = 1 , right = 1 , top = 0 , bottom = 0 }
160
+ if border == ' padded' then
161
+ left = 1
162
+ right = 1
160
163
elseif border == ' shadow' then
161
- return { vertical = 1 , horizontal = 1 , left = 0 , right = 1 , top = 0 , bottom = 1 }
162
- elseif type (border ) == ' string' then
163
- return { vertical = 2 , horizontal = 2 , left = 1 , right = 1 , top = 1 , bottom = 1 }
164
- elseif type (border ) == ' table' and border ~= nil then
164
+ right = 1
165
+ bottom = 1
166
+ elseif type (border ) == ' string' and border ~= ' none' then
167
+ left = 1
168
+ right = 1
169
+ top = 1
170
+ bottom = 1
171
+ elseif type (border ) == ' table' then
165
172
-- borders can be a table of strings and act differently with different # of chars
166
173
-- so we normalize it: https://neovim.io/doc/user/api.html#nvim_open_win()
167
174
-- based on nvim-cmp
@@ -173,17 +180,18 @@ function win:get_border_size()
173
180
end
174
181
end
175
182
176
- local top = resolved_border [2 ] == ' ' and 0 or 1
177
- local bottom = resolved_border [6 ] == ' ' and 0 or 1
178
- local left = resolved_border [8 ] == ' ' and 0 or 1
179
- local right = resolved_border [4 ] == ' ' and 0 or 1
180
- return { vertical = top + bottom , horizontal = left + right , left = left , right = right , top = top , bottom = bottom }
183
+ top = resolved_border [2 ] == ' ' and 0 or 1
184
+ bottom = resolved_border [6 ] == ' ' and 0 or 1
185
+ left = resolved_border [8 ] == ' ' and 0 or 1
186
+ right = resolved_border [4 ] == ' ' and 0 or 1
181
187
end
182
188
183
189
if self .scrollbar and self .scrollbar :is_visible () then
184
- return { vertical = 0 , horizontal = 1 , left = 0 , right = 1 , top = 0 , bottom = 0 }
190
+ local offset = (border == ' none' or border == ' padded' ) and 1 or 0
191
+ right = right + offset
185
192
end
186
- return { vertical = 0 , horizontal = 0 , left = 0 , right = 0 , top = 0 , bottom = 0 }
193
+
194
+ return { vertical = top + bottom , horizontal = left + right , left = left , right = right , top = top , bottom = bottom }
187
195
end
188
196
189
197
--- Gets the height of the window, taking into account the border
0 commit comments