Support all ASCII characters in migemo, without whitespace.

1. Ignore whitespace because migemo doesn't generate any useful regexp for whitespace.
2. Fix not to escape any ASCII characters (e.g. `*`, `.`) if migemo is enabled,  because `s:convertMigemo()` will replace them with migemo-regexps.
3. Remove verifying `re` in `s:convertMigemo()`, because `s:should_use_migemo()` already verified it.
This commit is contained in:
Kyohei Morihiro 2017-04-06 13:55:34 +09:00
parent 19d00afefe
commit 450f14521b
4 changed files with 285 additions and 164 deletions

View File

@ -561,14 +561,15 @@ function! s:convertRegep(input) "{{{
" 2. migemo " 2. migemo
" 3. smartsign " 3. smartsign
" 4. smartcase " 4. smartcase
let re = s:should_use_regexp() ? a:input : s:escape_regexp_char(a:input) let use_migemo = s:should_use_migemo(a:input)
let re = use_migemo || s:should_use_regexp() ? a:input : s:escape_regexp_char(a:input)
" Convert space to match only start of spaces " Convert space to match only start of spaces
if re ==# ' ' if re ==# ' '
let re = '\s\+' let re = '\s\+'
endif endif
if s:should_use_migemo(a:input) if use_migemo
let re = s:convertMigemo(re) let re = s:convertMigemo(re)
endif endif
@ -593,10 +594,7 @@ function! s:convertMigemo(re) "{{{
if ! has_key(s:migemo_dicts, &l:encoding) if ! has_key(s:migemo_dicts, &l:encoding)
let s:migemo_dicts[&l:encoding] = EasyMotion#helper#load_migemo_dict() let s:migemo_dicts[&l:encoding] = EasyMotion#helper#load_migemo_dict()
endif endif
if re =~# '^\a$' return get(s:migemo_dicts[&l:encoding], re, a:re)
let re = get(s:migemo_dicts[&l:encoding], re, a:re)
endif
return re
endfunction "}}} endfunction "}}}
function! s:convertSmartsign(chars) "{{{ function! s:convertSmartsign(chars) "{{{
" Convert given chars to smartsign string " Convert given chars to smartsign string
@ -641,7 +639,7 @@ function! s:should_use_regexp() "{{{
return g:EasyMotion_use_regexp == 1 && s:flag.regexp == 1 return g:EasyMotion_use_regexp == 1 && s:flag.regexp == 1
endfunction "}}} endfunction "}}}
function! s:should_use_migemo(char) "{{{ function! s:should_use_migemo(char) "{{{
if ! g:EasyMotion_use_migemo || match(a:char, '\A') != -1 if ! g:EasyMotion_use_migemo || match(a:char, '[^!-~]') != -1
return 0 return 0
endif endif

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long