From 50a394b2bfa93674381cb913d6330e5075b5c787 Mon Sep 17 00:00:00 2001 From: Ali Rezvani <3788964+rzvxa@users.noreply.github.com> Date: Fri, 1 Dec 2023 22:42:13 +0330 Subject: [PATCH] fix: Make NERDTreeFind to handle directory case sensitivity (#1387) Co-authored-by: Dan Gibson --- lib/nerdtree/path.vim | 2 +- lib/nerdtree/tree_dir_node.vim | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim index 4d97a6f..e0c1d95 100644 --- a/lib/nerdtree/path.vim +++ b/lib/nerdtree/path.vim @@ -549,7 +549,7 @@ function! s:Path.isUnder(parent) return 0 endif for i in range(0, l:that_count-1) - if self.pathSegments[i] !=# a:parent.pathSegments[i] + if !nerdtree#pathEquals(self.pathSegments[i], a:parent.pathSegments[i]) return 0 endif endfor diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim index cfda3c4..3fb3833 100644 --- a/lib/nerdtree/tree_dir_node.vim +++ b/lib/nerdtree/tree_dir_node.vim @@ -121,8 +121,14 @@ function! s:TreeDirNode.findNode(path) if a:path.equals(self.path) return self endif - if stridx(a:path.str(), self.path.str(), 0) ==# -1 - return {} + if nerdtree#caseSensitiveFS() + if stridx(a:path.str(), self.path.str(), 0) ==# -1 + return {} + endif + else + if stridx(tolower(a:path.str()), tolower(self.path.str()), 0) ==# -1 + return {} + endif endif if self.path.isDirectory