Skip to content

Commit

Permalink
Revert to old way of tracking insert mode change
Browse files Browse the repository at this point in the history
b:changedtick is incremented by the feedkeys() call which screws us up and
there doesn't seem to be a way around it that's worth the hassle.
  • Loading branch information
Valloric committed Aug 4, 2013
1 parent fc3a303 commit 4db6fb8
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions autoload/youcompleteme.vim
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ let s:omnifunc_mode = 0

let s:old_cursor_position = []
let s:cursor_moved = 0
let s:moved_vertically_in_insert_mode = 0
let s:previous_num_chars_on_current_line = -1

function! youcompleteme#Enable()
" When vim is in diff mode, don't run
Expand Down Expand Up @@ -357,9 +359,23 @@ endfunction


function! s:BufferTextChangedSinceLastMoveInInsertMode()
let buffer_changed = b:changedtick != b:ycm_changedtick.insert_mode_move
let b:ycm_changedtick.insert_mode_move = b:changedtick
return buffer_changed
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('.') )

if s:previous_num_chars_on_current_line == -1
let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line
return 0
endif

let changed_text_on_current_line = num_chars_in_current_cursor_line !=
\ s:previous_num_chars_on_current_line
let s:previous_num_chars_on_current_line = num_chars_in_current_cursor_line

return changed_text_on_current_line
endfunction


Expand Down

0 comments on commit 4db6fb8

Please sign in to comment.