Skip to content

Commit

Permalink
bugfix for #282
Browse files Browse the repository at this point in the history
  • Loading branch information
jayli committed Dec 21, 2023
1 parent abf4f41 commit c63674f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
18 changes: 3 additions & 15 deletions autoload/easycomplete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 "\<C-H>"
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 "\<C-H>"
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()
Expand Down
2 changes: 1 addition & 1 deletion autoload/easycomplete/popup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit c63674f

Please sign in to comment.