mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-16 15:23:51 -05: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:
@@ -425,7 +425,7 @@ function! s:GitCmd() abort
|
|||||||
call add(list, '/usr/bin/env')
|
call add(list, '/usr/bin/env')
|
||||||
endif
|
endif
|
||||||
while string =~# '\S'
|
while string =~# '\S'
|
||||||
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+')
|
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^' . "\t" . ' |]\)\+')
|
||||||
let string = strpart(string, len(arg))
|
let string = strpart(string, len(arg))
|
||||||
let arg = substitute(arg, '^\s\+', '', '')
|
let arg = substitute(arg, '^\s\+', '', '')
|
||||||
let arg = substitute(arg,
|
let arg = substitute(arg,
|
||||||
@@ -2027,7 +2027,7 @@ function! s:SplitExpandChain(string, ...) abort
|
|||||||
if string =~# '^\s*|'
|
if string =~# '^\s*|'
|
||||||
return [list, substitute(string, '^\s*', '', '')]
|
return [list, substitute(string, '^\s*', '', '')]
|
||||||
endif
|
endif
|
||||||
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^[:space:] |]\)\+')
|
let arg = matchstr(string, '^\s*\%(' . dquote . '''[^'']*''\|\\.\|[^' . "\t" . ' |]\)\+')
|
||||||
let string = strpart(string, len(arg))
|
let string = strpart(string, len(arg))
|
||||||
let arg = substitute(arg, '^\s\+', '', '')
|
let arg = substitute(arg, '^\s\+', '', '')
|
||||||
if !exists('seen_separator')
|
if !exists('seen_separator')
|
||||||
@@ -5935,7 +5935,7 @@ function! s:ArgSplit(string) abort
|
|||||||
let string = a:string
|
let string = a:string
|
||||||
let args = []
|
let args = []
|
||||||
while string =~# '\S'
|
while string =~# '\S'
|
||||||
let arg = matchstr(string, '^\s*\%(\\.\|[^[:space:]]\)\+')
|
let arg = matchstr(string, '^\s*\%(\\.\|\S\)\+')
|
||||||
let string = strpart(string, len(arg))
|
let string = strpart(string, len(arg))
|
||||||
let arg = substitute(arg, '^\s\+', '', '')
|
let arg = substitute(arg, '^\s\+', '', '')
|
||||||
call add(args, substitute(arg, '\\\+[|" ]', '\=submatch(0)[len(submatch(0))/2 : -1]', 'g'))
|
call add(args, substitute(arg, '\\\+[|" ]', '\=submatch(0)[len(submatch(0))/2 : -1]', 'g'))
|
||||||
|
|||||||
Reference in New Issue
Block a user