Add scrolloff option for completion window.
This commit is contained in:
@@ -609,6 +609,12 @@ window.{completion,documentation}.zindex~
|
||||
The completion window's zindex.
|
||||
See |nvim_open_win|.
|
||||
|
||||
*cmp-config.window.{completion,documentation}.scrolloff*
|
||||
window.completion.scrolloff~
|
||||
`number`
|
||||
Specify the window's scrolloff option.
|
||||
See |'scrolloff'|.
|
||||
|
||||
*cmp-config.window.completion.col_offset*
|
||||
window.completion.col_offset~
|
||||
`number`
|
||||
|
||||
@@ -91,6 +91,7 @@ return function()
|
||||
completion = {
|
||||
border = { '', '', '', '', '', '', '', '' },
|
||||
winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None',
|
||||
scrolloff = 0,
|
||||
col_offset = 0,
|
||||
side_padding = 1,
|
||||
},
|
||||
|
||||
@@ -6,6 +6,7 @@ window.bordered = function(opts)
|
||||
border = opts.border or 'rounded',
|
||||
winhighlight = opts.winhighlight or 'Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None',
|
||||
zindex = opts.zindex or 1001,
|
||||
scrolloff = opts.scrolloff or 0,
|
||||
col_offset = opts.col_offset or 0,
|
||||
side_padding = opts.side_padding or 1,
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ cmp.ItemField = {
|
||||
---@field public zindex integer|nil
|
||||
---@field public max_width integer|nil
|
||||
---@field public max_height integer|nil
|
||||
---@field public scrolloff integer|nil
|
||||
|
||||
---@class cmp.ConfirmationConfig
|
||||
---@field public default_behavior cmp.ConfirmBehavior
|
||||
|
||||
@@ -30,7 +30,6 @@ custom_entries_view.new = function()
|
||||
self.entries_win:option('cursorlineopt', 'line')
|
||||
self.entries_win:option('foldenable', false)
|
||||
self.entries_win:option('wrap', false)
|
||||
self.entries_win:option('scrolloff', 0)
|
||||
-- This is done so that strdisplaywidth calculations for lines in the
|
||||
-- custom_entries_view window exactly match with what is really displayed,
|
||||
-- see comment in cmp.Entry.get_view. Setting tabstop to 1 makes all tabs be
|
||||
@@ -195,6 +194,7 @@ custom_entries_view.open = function(self, offset, entries)
|
||||
-- Apply window options (that might be changed) on the custom completion menu.
|
||||
self.entries_win:option('winblend', vim.o.pumblend)
|
||||
self.entries_win:option('winhighlight', completion.winhighlight)
|
||||
self.entries_win:option('scrolloff', completion.scrolloff)
|
||||
self.entries_win:open({
|
||||
relative = 'editor',
|
||||
style = 'minimal',
|
||||
|
||||
Reference in New Issue
Block a user