Skip to content

Commit

Permalink
Fix not updating 'b:AutoCenter_MaxChangeNr' when a change in Insert mode
Browse files Browse the repository at this point in the history
or Replace mode is done.
  • Loading branch information
Ace-Who committed Apr 12, 2017
1 parent ad5a8e0 commit 64bb161
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/AutoCenter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function! AutoCenter#On() "{{{
" text changes. So we don't center text in these cases.
autocmd TextChanged,TextChangedI *
\ if !s:isUndoRedo() | call s:center() | endif
autocmd BufEnter * call s:upMaxChangeNr()
autocmd BufEnter,InsertLeave * call s:upMaxChangeNr()
augroup END
call s:upMaxChangeNr()
call s:saveMapping() " Save mappings for later restoring.
Expand Down Expand Up @@ -56,7 +56,7 @@ function! s:center() "{{{
call cursor('.', l:curpos + indent('.'))
" An ongoing change in Insert mode or Replace mode is not taken as a new
" change if updating the 'b:AutoCenter_MaxChangeNr' during this time. To avoid
" this, wait until it is done.
" this, wait until it is done, i.e., the autocmd event 'InsertLeave' occurs.
if mode() !~ '^[iR]'
call s:upMaxChangeNr()
endif
Expand Down

0 comments on commit 64bb161

Please sign in to comment.