Fix: close the view if cmp.enabled = false and the user types some text (#781)
A scenario where this lead to unintended behaviour previously was the following: If cmp.enabled was configured such that it disabled cmp when in a comment, and the user typed '--' in a lua file (this starts a comment), the cmp window would not close if further text is typed on that line (although cmp should be disabled).
This commit is contained in:
committed by
GitHub
parent
a7fea2ca9f
commit
df05fe6ff4
@@ -309,12 +309,18 @@ end)
|
||||
autocmd.subscribe('TextChanged', function()
|
||||
if config.enabled() then
|
||||
cmp.core:on_change('TextChanged')
|
||||
else
|
||||
cmp.core:reset()
|
||||
cmp.core.view:close()
|
||||
end
|
||||
end)
|
||||
|
||||
autocmd.subscribe('CursorMoved', function()
|
||||
if config.enabled() then
|
||||
cmp.core:on_moved()
|
||||
else
|
||||
cmp.core:reset()
|
||||
cmp.core.view:close()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user