From c63674fb7db8bbd4c2f885070f4e62befa9afa8a Mon Sep 17 00:00:00 2001 From: jayli Date: Thu, 21 Dec 2023 10:14:11 +0800 Subject: [PATCH] bugfix for #282 --- autoload/easycomplete.vim | 18 +++--------------- autoload/easycomplete/popup.vim | 2 +- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/autoload/easycomplete.vim b/autoload/easycomplete.vim index 3d825324..17d5cc07 100644 --- a/autoload/easycomplete.vim +++ b/autoload/easycomplete.vim @@ -650,35 +650,23 @@ function! s:BackingCompleteHandler() let g:easycomplete_stunt_menuitems = s:GetCompleteCache(s:GetTypingWordByGtx())['menu_items'] let start_pos = col('.') - strlen(s:GetTypingWordByGtx()) let result = g:easycomplete_stunt_menuitems[0 : g:easycomplete_maxlength] - call s:StopAsyncRun() - call s:AsyncRun(function("s:complete"), [start_pos, result], 0) + noa silent! call complete(start_pos, result) endif endif endfunction function! easycomplete#BackSpace() + return "\" if pumvisible() - " backspace 都会关闭 pum,这里尽量避免关闭 pum 带来的闪烁 let l:items = complete_info()["items"] let l:startcol = get(g:easycomplete_firstcomplete_ctx, "startcol", 0) if l:startcol != 0 && l:startcol < col('.') - 1 - call s:StopAsyncRun() - call s:AsyncRun(function("s:RemainPumWhileBS"), [l:startcol, l:items], 0) + " call s:CreateShadowWindow() endif endif return "\" endfunction -function! s:RemainPumWhileBS(startcol, items) - if !(&completeopt =~ "noselect") - setlocal completeopt+=noselect - silent noa call s:SimpleComplete(a:startcol, a:items) - setlocal completeopt-=noselect - else - silent noa call s:SimpleComplete(a:startcol, a:items) - endif -endfunction - " 正常输入和退格监听函数 " for firstcompele typing and back typing function! easycomplete#typing() diff --git a/autoload/easycomplete/popup.vim b/autoload/easycomplete/popup.vim index 6ff4f459..4664f016 100644 --- a/autoload/easycomplete/popup.vim +++ b/autoload/easycomplete/popup.vim @@ -475,7 +475,7 @@ function! s:NVimShow(opt, windowtype, float_type) endif silent noa let winid = nvim_open_win(s:buf[a:windowtype], v:false, winargs[2]) let g:easycomplete_popup_win[a:windowtype] = winid - if has('nvim-0.10.0') + if exists("*nvim_win_set_option") call nvim_win_set_option(winid, 'winhl', 'Normal:Pmenu,NormalNC:Pmenu') endif if exists('*nvim_win_set_config')