Skip to content

Commit f6cbd24

Browse files
committed
preservim#1344 Fixes NERDTreeFind: Exception not caught: NERDTree.InvalidArgumentsError: <file> should be under <path>
1 parent fc85a6f commit f6cbd24

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

lib/nerdtree/path.vim

+8-2
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,14 @@ function! s:Path.isUnder(parent)
530530
return 0
531531
endif
532532
for i in range(0, l:that_count-1)
533-
if self.pathSegments[i] !=# a:parent.pathSegments[i]
534-
return 0
533+
if nerdtree#runningWindows()
534+
if lower(self.pathSegments[i]) !=# lower(a:parent.pathSegments[i])
535+
return 0
536+
endif
537+
else
538+
if self.pathSegments[i] !=# a:parent.pathSegments[i]
539+
return 0
540+
endif
535541
endif
536542
endfor
537543
return 1

lib/nerdtree/tree_dir_node.vim

+8-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,14 @@ function! s:TreeDirNode.findNode(path)
121121
if a:path.equals(self.path)
122122
return self
123123
endif
124-
if stridx(a:path.str(), self.path.str(), 0) ==# -1
125-
return {}
124+
if nerdtree#runningWindows()
125+
if stridx(lower(a:path.str()), lower(self.path.str()), 0) ==# -1
126+
return {}
127+
endif
128+
else
129+
if stridx(a:path.str(), self.path.str(), 0) ==# -1
130+
return {}
131+
endif
126132
endif
127133

128134
if self.path.isDirectory

0 commit comments

Comments
 (0)