Skip to content

Commit

Permalink
Fix terryma#11 chaining function calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Borisov committed Apr 11, 2016
1 parent 47c9e3f commit 1b25ab1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autoload/multiple_cursors.vim
Original file line number Diff line number Diff line change
Expand Up @@ -886,21 +886,23 @@ function! s:process_user_input()
" Grr this is frustrating. In Insert mode, between the feedkey call and here,
" the current position could actually CHANGE for some odd reason. Forcing a
" position reset here
call cursor(s:cm.get_current().position)
let cursor_position = s:cm.get_current()
call cursor(cursor_position.position)

" Before applying the user input, we need to revert back to the mode the user
" was in when the input was entered
call s:revert_mode(s:to_mode, s:from_mode)

" Update the line length BEFORE applying any actions. TODO(terryma): Is there
" a better place to do this?
call s:cm.get_current().update_line_length()
" let cursor_position = s:cm.get_current()
call cursor_position.update_line_length()
let s:saved_linecount = line('$')

" Restore unnamed register only in Normal mode. This should happen before user
" input is processed.
if s:from_mode ==# 'n' || s:from_mode ==# 'v' || s:from_mode ==# 'V'
call s:cm.get_current().restore_unnamed_register()
call cursor_position.restore_unnamed_register()
endif

" Apply the user input. Note that the above could potentially change mode, we
Expand Down

0 comments on commit 1b25ab1

Please sign in to comment.