Bug fix: escaping in syntastic#util#fname2buf().

This commit is contained in:
LCD 47 2016-09-01 14:12:02 +03:00
parent 00ad38dd5e
commit 287aeeb925
2 changed files with 13 additions and 2 deletions

View File

@ -273,7 +273,18 @@ endfunction " }}}2
" Returns the buffer number of a filename " Returns the buffer number of a filename
function! syntastic#util#fname2buf(fname) abort " {{{2 function! syntastic#util#fname2buf(fname) abort " {{{2
return bufnr('^' . escape( fnamemodify(a:fname, ':p'), '\$.*~[' ) . '$') " this is a best-effort attempt to escape file patterns (cf. :h file-pattern)
" XXX it fails for filenames containing something like \{2,3}
if exists('+shellslash')
let old_shellslash = &shellslash
let &shellslash = 1
let buf = bufnr(escape( fnamemodify(a:fname, ':p'), '\*?,{[' ))
let &shellslash = old_shellslash
else
let buf = bufnr(escape( fnamemodify(a:fname, ':p'), '\*?,{}[' ))
endif
return buf
endfunction " }}}2 endfunction " }}}2
" Returns unique elements in a list " Returns unique elements in a list

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.7.0-204' let g:_SYNTASTIC_VERSION = '3.7.0-205'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1