From 71abdd8434a2d68054927e47e60c827a49492cd8 Mon Sep 17 00:00:00 2001 From: lijing00333 Date: Sat, 30 Dec 2023 21:06:23 +0800 Subject: [PATCH] bugfix for #291 --- autoload/easycomplete.vim | 3 +++ autoload/easycomplete/action/signature.vim | 4 ++++ autoload/easycomplete/popup.vim | 14 +++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/autoload/easycomplete.vim b/autoload/easycomplete.vim index 49cd2f4f..0d7e4313 100644 --- a/autoload/easycomplete.vim +++ b/autoload/easycomplete.vim @@ -2244,6 +2244,9 @@ function! easycomplete#CursorMovedI() if g:env_is_nvim && easycomplete#pum#visible() call easycomplete#pum#close() endif + if easycomplete#action#signature#visible() + call easycomplete#popup#close("float") + endif endif endfunction diff --git a/autoload/easycomplete/action/signature.vim b/autoload/easycomplete/action/signature.vim index 888ca0d5..80f3a4b3 100644 --- a/autoload/easycomplete/action/signature.vim +++ b/autoload/easycomplete/action/signature.vim @@ -176,6 +176,10 @@ function! s:SignatureCallback(title, param, doc) \ 'Pmenu', 0, "", [0, 0 - offset], 'signature') endfunction +function! easycomplete#action#signature#visible() + return easycomplete#popup#SignatureVisible() +endfunction + function! s:GetParameterLabel(signature, parameter) abort if has_key(a:parameter, 'label') if type(a:parameter['label']) == type([]) diff --git a/autoload/easycomplete/popup.vim b/autoload/easycomplete/popup.vim index d7939a60..87f72497 100644 --- a/autoload/easycomplete/popup.vim +++ b/autoload/easycomplete/popup.vim @@ -20,7 +20,7 @@ let s:float_max_height = 15 let s:is_vim = !has('nvim') let s:is_nvim = has('nvim') " signature/lint -let s:float_type = "signature" +let s:float_type = "" augroup easycomplete#popup#au autocmd! @@ -230,6 +230,15 @@ function! easycomplete#popup#float(content, hl, direction, ft, offset, float_typ elseif s:is_vim call s:VimShow(opt, "float", a:float_type) endif + let s:float_type = a:float_type +endfunction + +function! easycomplete#popup#SignatureVisible() + if empty(s:float_type) || empty(g:easycomplete_popup_win["float"]) + return v:false + else + return v:true + endif endfunction " 这里只判断complete menu和float 之间是否有overlay @@ -556,6 +565,9 @@ function! easycomplete#popup#close(...) return endif let windowtype = a:1 + if windowtype == "float" + let s:float_type = "" + endif if windowtype == "float" && \ bufnr() != expand("") && \ !empty(expand("")) &&