diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2020-11-20 19:12:46 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2020-11-20 19:12:46 +0900 |
commit | a39f78f5e599ef29cc15c46c352ec5560e0f8e73 (patch) | |
tree | 220aaf339c3f074a8372d3d58ea67f854c9575dc /autoload/deoplete/handler.vim | |
parent | 8249a0f2f27a84aa33116e392f4e79bcb20864b8 (diff) | |
download | deoplete.nvim-a39f78f5e599ef29cc15c46c352ec5560e0f8e73.zip |
Fix #1149 add refresh_backspace option
Diffstat (limited to 'autoload/deoplete/handler.vim')
-rw-r--r-- | autoload/deoplete/handler.vim | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim index bf98ce5..8ff2023 100644 --- a/autoload/deoplete/handler.vim +++ b/autoload/deoplete/handler.vim @@ -186,8 +186,20 @@ endfunction function! deoplete#handler#_completion_begin(event) abort call deoplete#custom#_update_cache() - if s:is_skip(a:event) + let auto_popup = deoplete#custom#_get_option( + \ 'auto_complete_popup') !=# 'manual' + let prev_input = get(g:deoplete#_context, 'input', '') + let cur_input = deoplete#util#get_input(a:event) + + let check_back_space = auto_popup + \ && cur_input !=# prev_input + \ && len(cur_input) + 1 ==# len(prev_input) + \ && stridx(prev_input, cur_input) == 0 + let refresh_backspace = deoplete#custom#_get_option('refresh_backspace') + + if s:is_skip(a:event) || (check_back_space && !refresh_backspace) let g:deoplete#_context.candidates = [] + let g:deoplete#_context.input = cur_input return endif @@ -201,14 +213,7 @@ function! deoplete#handler#_completion_begin(event) abort \ 'deoplete_auto_completion_begin', {'event': a:event}) " For <BS> popup flicker - let auto_popup = deoplete#custom#_get_option( - \ 'auto_complete_popup') !=# 'manual' - let prev_input = get(g:deoplete#_context, 'input', '') - let cur_input = deoplete#util#get_input(a:event) - if auto_popup && empty(v:completed_item) - \ && cur_input !=# prev_input - \ && len(cur_input) + 1 ==# len(prev_input) - \ && stridx(prev_input, cur_input) == 0 + if check_back_space && empty(v:completed_item) call feedkeys("\<Plug>_", 'i') endif endfunction |