Fix dotrepeat with count

- s:EasyMotion always reset s:flag, s:current
- use for instead of while
This commit is contained in:
haya14busa 2014-06-12 11:50:33 +09:00
parent 47f8bbc121
commit cd63e50838

View File

@ -281,6 +281,8 @@ function! EasyMotion#Repeat(visualmode) " {{{
return s:EasyMotion_is_cancelled
endfunction " }}}
function! EasyMotion#DotRepeat(visualmode) " {{{
let cnt = v:count1 " avoid overwriting
" Repeat previous '.' motion with previous targets and operator
if !has_key(s:dot_repeat, 'regexp')
call s:Message("Previous motion doesn't exist")
@ -291,16 +293,16 @@ function! EasyMotion#DotRepeat(visualmode) " {{{
let re = s:dot_repeat.regexp
let direction = s:dot_repeat.direction
let is_inclusive = s:dot_repeat.is_inclusive
let s:flag.within_line = s:dot_repeat.line_flag
let s:flag.bd_t = s:dot_repeat.bd_t_flag
let s:current.is_operator = 1
let i = 0
while i < v:count1
let s:flag.dot_repeat = 1 " s:EasyMotion() always call reset
for i in range(cnt)
" s:EasyMotion() always call reset s:flag & s:current
let s:flag.dot_repeat = 1
let s:flag.within_line = s:dot_repeat.line_flag
let s:flag.bd_t = s:dot_repeat.bd_t_flag
let s:current.is_operator = 1
silent call s:EasyMotion(re, direction, 0, is_inclusive)
let i += 1
endwhile
endfor
return s:EasyMotion_is_cancelled
endfunction " }}}
function! EasyMotion#NextPrevious(visualmode, direction) " {{{