From d67d804f44e27ecafc3a8b4b3abd5972d6e968ed Mon Sep 17 00:00:00 2001 From: lijing00333 Date: Thu, 14 Dec 2023 21:35:10 +0800 Subject: [PATCH] bugfix for #280 --- autoload/easycomplete.vim | 21 +++++---------------- autoload/easycomplete/sources/tn.vim | 6 +++++- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/autoload/easycomplete.vim b/autoload/easycomplete.vim index ae628749..f573ea50 100644 --- a/autoload/easycomplete.vim +++ b/autoload/easycomplete.vim @@ -384,21 +384,13 @@ function! easycomplete#FirstSelectedWithOptDefaultSelected() return v:false endfunction -" 当completeopt无noselect,展开pum且已经开始选择item动作(当前Cursored的位置不是第一个) -function! s:AntiFirstSelectedWithOptDefaultSelected() - if &completeopt =~ "noselect" - return v:false - endif - if !pumvisible() - return v:false - endif - if !easycomplete#CompleteCursored() - return v:false - endif - if complete_info()['selected'] > 0 +" 展开pum且已经开始选择item动作(当前Cursored的位置不是第一个) +function! easycomplete#PumSelecting() + if pumvisible() && complete_info()['selected'] > 0 return v:true + else + return v:false endif - return v:false endfunction function! easycomplete#SetCompletedItem(item) @@ -1498,9 +1490,6 @@ function! s:FirstCompleteRendering(start_pos, menuitems) if !pumvisible() let should_stop_render = 1 endif - if s:AntiFirstSelectedWithOptDefaultSelected() - let should_stop_render = 1 - endif endif if !should_stop_render && len(source_result) > 0 diff --git a/autoload/easycomplete/sources/tn.vim b/autoload/easycomplete/sources/tn.vim index 09e40de8..e5bf5e02 100644 --- a/autoload/easycomplete/sources/tn.vim +++ b/autoload/easycomplete/sources/tn.vim @@ -310,7 +310,7 @@ function! s:CompleteHandler(res) if !easycomplete#CompleteCursored() && &completeopt =~ "noselect" call easycomplete#util#call(function("s:UpdateRendering"), [result]) endif - if easycomplete#CompleteCursored() && !(&completeopt =~ "noselect") + if !easycomplete#PumSelecting() && !(&completeopt =~ "noselect") call easycomplete#util#call(function("s:UpdateRendering"), [result]) endif " if s:tn_render_timer > 0 @@ -439,3 +439,7 @@ endfunction function! s:StopAsyncRun(...) return call('easycomplete#util#StopAsyncRun', a:000) endfunction + +function! s:trace(...) + return call('easycomplete#util#trace', a:000) +endfunction