Refactoring shade regexp for witin line.

This commit is contained in:
haya14busa 2014-05-06 08:16:54 +09:00
parent 245035ba51
commit 5cc559dbe6

View File

@ -1256,27 +1256,18 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive) " {{{
" -- Shade inactive source --------------- {{{
if g:EasyMotion_do_shade && targets_len != 1 && s:flag.dot_repeat != 1
if a:direction == 1
" Backward
if s:flag.within_line
let shade_hl_re = '^.*\%#'
else
let shade_hl_re = '\%'. win_first_line .'l\_.*\%#'
endif
elseif a:direction == 0
" Forward
if s:flag.within_line
let shade_hl_re = '\%#.*$'
else
let shade_hl_re = '\%#\_.*\%'. win_last_line .'l'
endif
else
" Both directions"
if s:flag.within_line
let shade_hl_re = '^.*\%#.*$'
else
let shade_hl_re = '\_.*'
endif
if a:direction == 1 " Backward
let shade_hl_re = s:flag.within_line
\ ? '^.*\%#'
\ : '\%'. win_first_line .'l\_.*\%#'
elseif a:direction == 0 " Forward
let shade_hl_re = s:flag.within_line
\ ? '\%#.*$'
\ : '\%#\_.*\%'. win_last_line .'l'
else " Both directions
let shade_hl_re = s:flag.within_line
\ ? '^.*\%#.*$'
\ : '\_.*'
endif
call EasyMotion#highlight#add_highlight(