fix: pumvisible (#413)

* fix(popup): remove popup on nightly nvim >= 0.12

Fixes #391

* Update matchparen.vim

* fix: s:pumvisible fails when no cmp is installed

In the situation where `nvim-cmp` is not installed but `blink-compat`
is, the `pcall(require, "cmp")` goes through, but
`require("cmp").visible()` doesn't. Checking for `cmp.visible` type
fixes this issue.

* add extra width because of the line number

---------

Co-authored-by: Andy Massimino <andymass@users.noreply.github.com>
This commit is contained in:
Mohammad Reza Karimi
2025-10-03 09:44:29 -04:00
committed by GitHub
parent b23ba393ee
commit 9ae7f86c31

View File

@@ -508,8 +508,7 @@ endfunction
if has('nvim')
function s:pumvisible() abort
return pumvisible() || luaeval('pcall(require, "cmp")')
\ && luaeval('require"cmp".visible()')
return pumvisible() || luaeval('(function() local ok, cmp = pcall(require, "cmp") if ok and type(cmp.visible) == "function" then return cmp.visible() else return false end end)()')
endfunction
else
function s:pumvisible() abort
@@ -901,7 +900,7 @@ function! s:populate_floating_win(offscreen, text_method) abort " {{{1
let l:width += wincol()-virtcol('.')
let l:width = min([l:width, winwidth(0) - 1])
endif
call nvim_win_set_width(s:float_id, l:width + 1)
call nvim_win_set_width(s:float_id, l:width + 1 + strlen(line('$')))
if &winminheight != 1
let l:save_wmh = &winminheight