mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-16 07:13:52 -05: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:
@@ -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