Skip to content

Commit

Permalink
bugfix for #280
Browse files Browse the repository at this point in the history
  • Loading branch information
jayli committed Dec 14, 2023
1 parent 9a32147 commit d67d804
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
21 changes: 5 additions & 16 deletions autoload/easycomplete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion autoload/easycomplete/sources/tn.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit d67d804

Please sign in to comment.