Permalink
Browse files

Fix #409 #411 restore completeopt

  • Loading branch information...
1 parent 9486bac commit 6e529ab220f98a35c8c10911dbeca7597011c04a @Shougo committed Jan 8, 2017
Showing with 14 additions and 5 deletions.
  1. +2 −5 autoload/deoplete/handler.vim
  2. +6 −0 autoload/deoplete/mapping.vim
  3. +6 −0 rplugin/python3/deoplete/deoplete.py
@@ -51,6 +51,7 @@ endfunction
function! s:completion_begin(event) abort
let context = deoplete#init#_context(a:event, [])
if s:is_skip(a:event, context)
+ call deoplete#mapping#_restore_completeopt()
return
endif
@@ -75,7 +76,6 @@ function! s:completion_begin(event) abort
endfor
endfor
- call deoplete#mapping#_set_completeopt()
call rpcnotify(g:deoplete#_channel_id,
\ 'deoplete_auto_completion_begin', context)
endfunction
@@ -137,10 +137,7 @@ function! s:on_event(event) abort
endfunction
function! s:on_insert_leave() abort
- if exists('g:deoplete#_saved_completeopt')
- let &completeopt = g:deoplete#_saved_completeopt
- unlet g:deoplete#_saved_completeopt
- endif
+ call deoplete#mapping#_restore_completeopt()
let g:deoplete#_context = {}
endfunction
@@ -31,6 +31,12 @@ function! deoplete#mapping#_set_completeopt() abort
set completeopt+=noselect
endif
endfunction
+function! deoplete#mapping#_restore_completeopt() abort
+ if exists('g:deoplete#_saved_completeopt')
+ let &completeopt = g:deoplete#_saved_completeopt
+ unlet g:deoplete#_saved_completeopt
+ endif
+endfunction
function! deoplete#mapping#_rpcrequest_wrapper(sources) abort
call rpcnotify(g:deoplete#_channel_id,
\ 'deoplete_manual_completion_begin',
@@ -45,6 +45,8 @@ def completion_begin(self, context):
if not candidates or self.position_has_changed(
context['changedtick']) or self.__vim.funcs.mode() != 'i':
+ if 'deoplete#_saved_completeopt' in context['vars']:
+ self.__vim.call('deoplete#mapping#_restore_completeopt')
return
self.__vim.vars['deoplete#_context'] = {
@@ -54,6 +56,10 @@ def completion_begin(self, context):
'event': context['event'],
}
+ if context['event'] != 'Manual' and (
+ 'deoplete#_saved_completeopt' not in context['vars']):
+ self.__vim.call('deoplete#mapping#_set_completeopt')
+
self.__vim.feedkeys(context['start_complete'])
if self.__vim.call(
'has', 'patch-7.4.1758') and context['event'] != 'Manual':

0 comments on commit 6e529ab

Please sign in to comment.