Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vimoption2python no longer creates ambiguous regex syntax #939

Merged
merged 2 commits into from Feb 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions autoload/deoplete/util.vim
Expand Up @@ -68,6 +68,13 @@ function! s:vimoption2python(option) abort
elseif pattern ==# '-'
let has_dash = 1
else
" Avoid ambiguous Python 3 RE syntax for nested sets
if pattern =~# '^--'
let pattern = '\' . pattern
elseif pattern =~# '--$'
let pattern = split(pattern, '-')[0] . '-\-'
endif

call add(patterns, pattern)
endif
endfor
Expand Down
5 changes: 5 additions & 0 deletions test/autoload/deoplete/util.vim
Expand Up @@ -27,4 +27,9 @@ function! s:suite.vimoption2python() abort
call s:assert.equals(
\ deoplete#util#vimoption2python('45,48-57,65-90,95,97-122'),
\ '[\w0-9A-Z_a-z-]')
call s:assert.equals(
\ deoplete#util#vimoption2python('33,35-39,42-43,45-58,60-90,94,95,97-122,126'),
\ '[\w!#-''*-+\--:<-Z^_a-z~]')
call s:assert.equals(
\ deoplete#util#vimoption2python('33-45'), '[\w!-\-]')
endfunction