Add scrolloff option for completion window.

This commit is contained in:
hrsh7th
2022-10-02 19:47:01 +09:00
parent 2427d06b65
commit beb1d14c5e
5 changed files with 10 additions and 1 deletions

View File

@@ -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,
},

View File

@@ -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,
}

View File

@@ -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

View File

@@ -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',