fix: escape directories containing brackets([...]) for globbing (#1359)

This commit is contained in:
Kai 2023-10-22 15:28:09 +01:00 committed by GitHub
parent ea4833da8a
commit 9184ec05bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -278,6 +278,10 @@ function! s:TreeDirNode._glob(pattern, all)
else else
let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',') let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
if nerdtree#runningWindows()
let l:pathSpec = substitute(l:pathSpec, "\\[\\(.*\\]\\)", "[[]\\1", "g")
endif
" On Windows, the drive letter may be removed by "fnamemodify()". " On Windows, the drive letter may be removed by "fnamemodify()".
if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash() if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash()
let l:pathSpec = self.path.drive . l:pathSpec let l:pathSpec = self.path.drive . l:pathSpec