Don't completion by CursorMoved event
This commit is contained in:
@@ -180,6 +180,18 @@ core.on_change = function(self, event)
|
||||
end)
|
||||
end
|
||||
|
||||
---Cursor moved.
|
||||
core.on_moved = function(self)
|
||||
local ignore = false
|
||||
ignore = ignore or self.suspending
|
||||
ignore = ignore or (vim.fn.pumvisible() == 1 and (vim.v.completed_item).word)
|
||||
ignore = ignore or not self.view:visible()
|
||||
if ignore then
|
||||
return
|
||||
end
|
||||
self:filter()
|
||||
end
|
||||
|
||||
---Check autoindent
|
||||
---@param event cmp.TriggerEvent
|
||||
---@param callback function
|
||||
|
||||
@@ -231,6 +231,12 @@ autocmd.subscribe('TextChanged', function()
|
||||
end
|
||||
end)
|
||||
|
||||
autocmd.subscribe('CursorMoved', function()
|
||||
if config.enabled() then
|
||||
cmp.core:on_moved()
|
||||
end
|
||||
end)
|
||||
|
||||
autocmd.subscribe('InsertLeave', function()
|
||||
cmp.core:reset()
|
||||
cmp.core.view:close()
|
||||
|
||||
Reference in New Issue
Block a user