Add cmp.visible
This commit is contained in:
@@ -434,6 +434,12 @@ Programatic API
|
|||||||
|
|
||||||
You can use the following APIs.
|
You can use the following APIs.
|
||||||
|
|
||||||
|
#### `cmp.visible()`
|
||||||
|
|
||||||
|
Return the completion menu is visible or not.
|
||||||
|
|
||||||
|
NOTE: This method returns true if the native popup menu is visible. For convenience to define mappings.
|
||||||
|
|
||||||
#### `cmp.confirm({ select = boolean, behavior = cmp.ConfirmBehavior.{Insert,Replace} })`
|
#### `cmp.confirm({ select = boolean, behavior = cmp.ConfirmBehavior.{Insert,Replace} })`
|
||||||
|
|
||||||
Confirm current selected item if possible.
|
Confirm current selected item if possible.
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ window.get_content_height = function(self)
|
|||||||
}, function()
|
}, function()
|
||||||
local height = 0
|
local height = 0
|
||||||
for _, text in ipairs(vim.api.nvim_buf_get_lines(self.buf, 0, -1, false)) do
|
for _, text in ipairs(vim.api.nvim_buf_get_lines(self.buf, 0, -1, false)) do
|
||||||
height = height + math.ceil(math.max(1, vim.fn.strdisplaywidth(text)) / self.style.width)
|
height = height + math.ceil(math.max(1, vim.str_utfindex(text)) / self.style.width)
|
||||||
end
|
end
|
||||||
return height
|
return height
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user