Closed wincent closed 4 years ago
Thanks for debugging this! Does this patch work instead?
diff --git a/autoload/dirvish.vim b/autoload/dirvish.vim
index 4fd26a2..9c65b26 100644
--- a/autoload/dirvish.vim
+++ b/autoload/dirvish.vim
@@ -53,7 +53,7 @@ endif
function! s:list_dir(dir) abort
" Escape for glob().
- let dir_esc = escape(substitute(a:dir,'\[','[[]','g'),'{}')
+ let dir_esc = escape(substitute(a:dir,'\[','[[]','g'),'{}$')
let paths = s:globlist(dir_esc.'*')
"Append dot-prefixed files. glob() cannot do both in 1 pass.
let paths = paths + s:globlist(dir_esc.'.[^.]*')
related: https://github.com/justinmk/vim-dirvish/pull/184 , https://github.com/justinmk/vim-dirvish/pull/190
Yep, that works @justinmk. Both for the synthetic test case that I listed in the summary and the real-world scenario where I originally ran into this.
To reproduce
Then hit
-
to bring up Dirvish.Expected result
Actual result
x$y/
.If you hit
-
again, you will see the directory that contains the problem folder, andx$y/
is present in the list.Observations
Problem is that the
glob()
call here is returning an empty list.glob('/private/var/folders/yc/1x2y2qld1g95tvtjpd89hdrm0000gp/T/tmp.5UImj1z0/x$y/*', 1, 1)
produces an empty list.glob('/private/var/folders/yc/1x2y2qld1g95tvtjpd89hdrm0000gp/T/tmp.5UImj1z0/x$y/*', 0, 1)
produces an empty list also (ie. behavior is independent of suffix argument, and in any case, my'wildignore'
is*.o,*.rej
).glob('/private/var/folders/yc/1x2y2qld1g95tvtjpd89hdrm0000gp/T/tmp.5UImj1z0/x\$y/*', 1, 1)
produces a non-empty list.ie. If I backslash-escape the
$
then everything works fine. In other words, anfnameescape()
would fix this, but that might also escape too much. 🤷♂️I'm testing this locally, but like I said, it may be too aggressive: