mirror of
https://github.com/tpope/vim-fugitive.git
synced 2026-10-16 11:01:33 +08:00
Account for optional escaping in tab complete
Tab complete results are always passed to fnameescape(), which can result in the output having more backslashes than the input, causing those results to be filtered out. Attempt to reconcile this. References: https://github.com/tpope/vim-fugitive/issues/1916
This commit is contained in:
1 parent
b6dbb97759
commit
88a97127d1
1 file changed
+7
-5
@@ -2328,12 +2328,14 @@ call s:add_methods('buffer', ['repo', 'type'])
|
||||
|
||||
function! s:FilterEscape(items, ...) abort
|
||||
let items = copy(a:items)
|
||||
call map(items, 's:fnameescape(v:val)')
|
||||
if a:0 && type(a:1) == type('')
|
||||
let cmp = s:FileIgnoreCase(1) ? '==?' : '==#'
|
||||
call filter(items, 'strpart(v:val, 0, strlen(a:1)) ' . cmp . ' a:1')
|
||||
call map(items, 'fnameescape(v:val)')
|
||||
if !a:0 || type(a:1) != type('')
|
||||
let match = ''
|
||||
else
|
||||
let match = substitute(a:1, '^[+>]\|\\\@<![' . substitute(s:fnameescape, '\\', '', '') . ']', '\\&', 'g')
|
||||
endif
|
||||
return items
|
||||
let cmp = s:FileIgnoreCase(1) ? '==?' : '==#'
|
||||
return filter(items, 'strpart(v:val, 0, strlen(match)) ' . cmp . ' match')
|
||||
endfunction
|
||||
|
||||
function! s:GlobComplete(lead, pattern, ...) abort
|
||||
|
||||
Reference in new issue
Block a user