Skip to content

Commit 686c17a

Browse files
authored
fix: Use winborder for window menu and fix scrollbar window (#2158)
1 parent 2c019de commit 686c17a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lua/cmp/config/default.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local compare = require('cmp.config.compare')
22
local types = require('cmp.types')
3+
local window = require('cmp.config.window')
34

45
local WIDE_HEIGHT = 40
56

@@ -107,7 +108,7 @@ return function()
107108

108109
window = {
109110
completion = {
110-
border = { '', '', '', '', '', '', '', '' },
111+
border = window.get_border(),
111112
winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None',
112113
winblend = vim.o.pumblend,
113114
scrolloff = 0,
@@ -118,7 +119,7 @@ return function()
118119
documentation = {
119120
max_height = math.floor(WIDE_HEIGHT * (WIDE_HEIGHT / vim.o.lines)),
120121
max_width = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))),
121-
border = { '', '', '', ' ', '', '', '', ' ' },
122+
border = window.get_border(),
122123
winhighlight = 'FloatBorder:NormalFloat',
123124
winblend = vim.o.pumblend,
124125
},

lua/cmp/config/window.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,13 @@ window.bordered = function(opts)
1313
}
1414
end
1515

16+
window.get_border = function()
17+
-- On neovim 0.11+, use the vim.o.winborder option by default
18+
local has_winborder, winborder = pcall(function() return vim.o.winborder end)
19+
if has_winborder and winborder ~= '' then return winborder end
20+
21+
-- On lower versions return the default
22+
return 'none'
23+
end
24+
1625
return window

0 commit comments

Comments
 (0)