Auto merge of #1619 - micbou:trigger-issues, r=Valloric

Fix trigger issues

Fix issues #1597 and #1598. These issues should contain enough information to understand the changes.

Thanks to @wladston.
This commit is contained in:
Homu 2015-08-05 03:32:02 +09:00
commit baaa8be65c

View File

@ -26,7 +26,7 @@ let s:omnifunc_mode = 0
let s:old_cursor_position = [] let s:old_cursor_position = []
let s:cursor_moved = 0 let s:cursor_moved = 0
let s:moved_vertically_in_insert_mode = 0 let s:moved_vertically_in_insert_mode = 0
let s:previous_num_chars_on_current_line = -1 let s:previous_num_chars_on_current_line = strlen( getline('.') )
let s:diagnostic_ui_filetypes = { let s:diagnostic_ui_filetypes = {
\ 'cpp': 1, \ 'cpp': 1,
@ -446,7 +446,6 @@ function! s:SetOmnicompleteFunc()
endif endif
endfunction endfunction
function! s:OnCursorMovedInsertMode() function! s:OnCursorMovedInsertMode()
if !s:AllowedToCompleteInCurrentFile() if !s:AllowedToCompleteInCurrentFile()
return return
@ -510,6 +509,8 @@ endfunction
function! s:OnInsertEnter() function! s:OnInsertEnter()
let s:previous_num_chars_on_current_line = strlen( getline('.') )
if !s:AllowedToCompleteInCurrentFile() if !s:AllowedToCompleteInCurrentFile()
return return
endif endif
@ -535,14 +536,9 @@ endfunction
function! s:BufferTextChangedSinceLastMoveInInsertMode() function! s:BufferTextChangedSinceLastMoveInInsertMode()
if s:moved_vertically_in_insert_mode
let s:previous_num_chars_on_current_line = -1
return 0
endif
let num_chars_in_current_cursor_line = strlen( getline('.') ) let num_chars_in_current_cursor_line = strlen( getline('.') )
if s:previous_num_chars_on_current_line == -1 if s:moved_vertically_in_insert_mode
let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line
return 0 return 0
endif endif