This commit is contained in:
hrsh7th
2021-10-11 16:29:42 +09:00
parent 071c08fcc9
commit 2f2794decd
8 changed files with 23 additions and 18 deletions

View File

@@ -121,7 +121,7 @@ custom_entries_view.open = function(self, offset, entries)
width = width + self.column_width.menu + 1
local cursor = vim.api.nvim_win_get_cursor(0)
local pos = vim.fn.screenpos('.', cursor[1], cursor[2] + 1)
local pos = vim.fn.screenpos(0, cursor[1], cursor[2] + 1)
local height = vim.api.nvim_get_option('pumheight')
height = height == 0 and #self.entries or height
height = math.min(height, #self.entries)

View File

@@ -3,6 +3,7 @@ local autocmd = require('cmp.utils.autocmd')
local keymap = require('cmp.utils.keymap')
local types = require('cmp.types')
local config = require('cmp.config')
local misc = require('cmp.utils.misc')
---@class cmp.NativeEntriesView
---@field private offset number
@@ -69,7 +70,7 @@ native_entries_view.open = function(self, offset, entries)
end
native_entries_view.close = function(self)
if string.sub(vim.api.nvim_get_mode().mode, 1, 1) == 'i' then
if misc.is_suitable_mode() then
vim.fn.complete(1, {})
end
self.offset = -1
@@ -79,7 +80,7 @@ native_entries_view.close = function(self)
end
native_entries_view.abort = function(_)
if string.sub(vim.api.nvim_get_mode().mode, 1, 1) == 'i' then
if misc.is_suitable_mode() then
vim.api.nvim_select_popupmenu_item(-1, true, true, {})
end
end