Check visual mode to adjust screen

This commit is contained in:
haya14busa 2014-01-15 22:36:27 +09:00
parent 32a7e1a8b7
commit b104fbffbe

View File

@ -1221,12 +1221,14 @@ function! s:EasyMotion(regexp, direction, visualmode, is_exclusive, ...) " {{{
endif endif
" }}} " }}}
" Jump back before prompt{{{ " -- Jump back before prompt for visual scroll {{{
" Because searchpos() change current cursor position and " Because searchpos() change current cursor position and
" if you just use cursor([orig_num, orig_pos]) to jump back, " if you just use cursor([orig_num, orig_pos]) to jump back,
" current line will bebecome center of window " current line will bebecome center of window
if ! empty(a:visualmode)
keepjumps call cursor(win_first_line,0) keepjumps call cursor(win_first_line,0)
normal! zt normal! zt
endif
"}}} "}}}
" -- Prompt user for target group/character {{{ " -- Prompt user for target group/character {{{
@ -1251,8 +1253,11 @@ function! s:EasyMotion(regexp, direction, visualmode, is_exclusive, ...) " {{{
normal! v normal! v
endif endif
" }}} " }}}
call cursor(win_first_line, 0) " Adjuast screen for visual scroll {{{
if ! empty(a:visualmode)
keepjumps call cursor(win_first_line, 0)
normal! zt normal! zt
endif "}}}
keepjumps call cursor(coords[0], coords[1]) keepjumps call cursor(coords[0], coords[1])
call s:Message('Jumping to [' . coords[0] . ', ' . coords[1] . ']') call s:Message('Jumping to [' . coords[0] . ', ' . coords[1] . ']')