Fix issue with omnifunc mode persisting
This can happen when the user inserts a candidate string like "operator[]" which doesn't end with an identifier char. A very obscure bug, but a bug nonetheless.
This commit is contained in:
parent
c20943db87
commit
e0c7db4ac5
@ -370,6 +370,13 @@ function! s:OnCursorMovedInsertMode()
|
||||
if g:ycm_auto_trigger || s:omnifunc_mode
|
||||
call s:InvokeCompletion()
|
||||
endif
|
||||
|
||||
" We have to make sure we correctly leave omnifunc mode even when the user
|
||||
" inserts something like a "operator[]" candidate string which fails
|
||||
" CurrentIdentifierFinished check.
|
||||
if s:omnifunc_mode && !pyeval( 'base.LastEnteredCharIsIdentifierChar()')
|
||||
let s:omnifunc_mode = 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -93,6 +93,20 @@ def CurrentIdentifierFinished():
|
||||
return line[ : current_column ].isspace()
|
||||
|
||||
|
||||
def LastEnteredCharIsIdentifierChar():
|
||||
current_column = vimsupport.CurrentColumn()
|
||||
previous_char_index = current_column - 1
|
||||
if previous_char_index < 0:
|
||||
return False
|
||||
line = vim.current.line
|
||||
try:
|
||||
previous_char = line[ previous_char_index ]
|
||||
except IndexError:
|
||||
return False
|
||||
|
||||
return utils.IsIdentifierChar( previous_char )
|
||||
|
||||
|
||||
def AdjustCandidateInsertionText( candidates ):
|
||||
"""This function adjusts the candidate insertion text to take into account the
|
||||
text that's currently in front of the cursor.
|
||||
|
Loading…
Reference in New Issue
Block a user