Skip to content

Fixes issue #1344 - windows folder casing issue #1346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/nerdtree/path.vim
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,14 @@ 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]
return 0
if nerdtree#runningWindows()
if tolower(self.pathSegments[i]) !=# tolower(a:parent.pathSegments[i])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I read through the discussion comments too quickly, this still needs addressing. Using tolower() should be unnecessary if explicitly using a case-insensitive matching operator.

Copy link
Member

@rzvxa rzvxa Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I'm sorry my example was wrong.
something like this should replace the old version.

if !nerdtree#caseSensitiveFS()
    if self.pathSegments[i] !=? a:parent.pathSegments[i]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dangibson
Hello sir,

Do you have any interest in completing this PR? If not I can create a PR containing your commits so I can add the requested changes while keeping the original author of the commits. But to be honest I would love it if you do these changes yourself, Since you already familiarized yourself with the codebase it can be an awesome thing to have somebody else contributing to the project.

If I wanted to implement this by myself it would've been a lot worse, since we had some conversation around implementing it we found many weak points and came up with a more solid implementation as a result. I love working with other developers, All of the good ideas come from people who cooperate for the greater good despite their takes on the subject matter.

I'll delay merging this PR for another week so you have time to read this comment and respond if you want to, And if you don't I totally understand.

Thanks for helping to Improve NERDTree, I've used this plugin since I was a kid in high school so It is literally keeping my childhood alive.

Sincerely yours,
Ali Rezvani

return 0
endif
else
if self.pathSegments[i] !=# a:parent.pathSegments[i]
return 0
endif
endif
endfor
return 1
Expand Down
10 changes: 8 additions & 2 deletions lib/nerdtree/tree_dir_node.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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#runningWindows()
if stridx(tolower(a:path.str()), tolower(self.path.str()), 0) ==# -1
return {}
endif
else
if stridx(a:path.str(), self.path.str(), 0) ==# -1
return {}
endif
endif

if self.path.isDirectory
Expand Down