mirror of
https://github.com/tpope/vim-fugitive.git
synced 2026-10-09 23:05:57 +08:00
Fix inconsistent whitespace matching in regexps
The \s and \S atoms consider space and tabs to be the only valid whitespace characters, while the [:space:] character class also includes control characters like newline and form feed.
This commit is contained in:
1 parent
0996bae836
commit
d9059413e2
1 file changed
+3
-3
@@ -425,7 +425,7 @@ function! s:GitCmd() abort
|
||||
call add(list, '/usr/bin/env')
|
||||
endif
|
||||
while string =~# '\S'
|
||||
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+')
|
||||
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^' . "\t" . ' |]\)\+')
|
||||
let string = strpart(string, len(arg))
|
||||
let arg = substitute(arg, '^\s\+', '', '')
|
||||
let arg = substitute(arg,
|
||||
@@ -2027,7 +2027,7 @@ function! s:SplitExpandChain(string, ...) abort
|
||||
if string =~# '^\s*|'
|
||||
return [list, substitute(string, '^\s*', '', '')]
|
||||
endif
|
||||
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+')
|
||||
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^' . "\t" . ' |]\)\+')
|
||||
let string = strpart(string, len(arg))
|
||||
let arg = substitute(arg, '^\s\+', '', '')
|
||||
if !exists('seen_separator')
|
||||
@@ -5935,7 +5935,7 @@ function! s:ArgSplit(string) abort
|
||||
let string = a:string
|
||||
let args = []
|
||||
while string =~# '\S'
|
||||
let arg = matchstr(string, '^\s*\%(\\.\|[^[:space:]]\)\+')
|
||||
let arg = matchstr(string, '^\s*\%(\\.\|\S\)\+')
|
||||
let string = strpart(string, len(arg))
|
||||
let arg = substitute(arg, '^\s\+', '', '')
|
||||
call add(args, substitute(arg, '\\\+[|" ]', '\=submatch(0)[len(submatch(0))/2 : -1]', 'g'))
|
||||
|
||||
Reference in new issue
Block a user