From 9ae7f86c3148d1181eb08fc65d7a5cfb4433890d Mon Sep 17 00:00:00 2001 From: Mohammad Reza Karimi Date: Fri, 3 Oct 2025 09:44:29 -0400 Subject: [PATCH] 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 --- autoload/matchup/matchparen.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autoload/matchup/matchparen.vim b/autoload/matchup/matchparen.vim index 790eb86..bee6a29 100644 --- a/autoload/matchup/matchparen.vim +++ b/autoload/matchup/matchparen.vim @@ -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