From 88a97127d1c960560535f580e1b2b1cd3ebfb75f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 5 Jan 2022 10:59:51 -0500 Subject: [PATCH] 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 --- autoload/fugitive.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 3971b8c..49aaab3 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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, '^[+>]\|\\\@