mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2670f0d19 |
@@ -5,6 +5,7 @@
|
|||||||
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
|
||||||
-->
|
-->
|
||||||
#### 6.7
|
#### 6.7
|
||||||
|
- **.11**: Fix exception in NERDTreeFind (on windows OS and If the file is located in the root directory of the disk) [#1122](https://github.com/preservim/nerdtree/pull/1122)
|
||||||
- **.10**: Do not consider the tree root to be "cascadable". (lifecrisis) [#1120](https://github.com/preservim/nerdtree/pull/1120)
|
- **.10**: Do not consider the tree root to be "cascadable". (lifecrisis) [#1120](https://github.com/preservim/nerdtree/pull/1120)
|
||||||
- **.9**: Force `:NERDTreeFocus` to allow events to be fired when switching windows. (PhilRunninger) [#1118](https://github.com/preservim/nerdtree/pull/1118)
|
- **.9**: Force `:NERDTreeFocus` to allow events to be fired when switching windows. (PhilRunninger) [#1118](https://github.com/preservim/nerdtree/pull/1118)
|
||||||
- **.8**: Fix example code for the `NERDTreeAddKeyMap()` function. (PhilRunninger) [#1116](https://github.com/preservim/nerdtree/pull/1116)
|
- **.8**: Fix example code for the `NERDTreeAddKeyMap()` function. (PhilRunninger) [#1116](https://github.com/preservim/nerdtree/pull/1116)
|
||||||
|
|||||||
@@ -249,7 +249,11 @@ function! s:Creator._pathForString(str)
|
|||||||
if dir =~# '^\.'
|
if dir =~# '^\.'
|
||||||
let dir = getcwd() . g:NERDTreePath.Slash() . dir
|
let dir = getcwd() . g:NERDTreePath.Slash() . dir
|
||||||
endif
|
endif
|
||||||
let dir = g:NERDTreePath.Resolve(dir)
|
|
||||||
|
"hack to prevent removing slash if dir is the root of the file system.
|
||||||
|
if dir !=# '/'
|
||||||
|
let dir = g:NERDTreePath.Resolve(dir)
|
||||||
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
let path = g:NERDTreePath.New(dir)
|
let path = g:NERDTreePath.New(dir)
|
||||||
|
|||||||
@@ -546,26 +546,36 @@ endfunction
|
|||||||
" return 1 if this path is somewhere above the given path in the filesystem.
|
" return 1 if this path is somewhere above the given path in the filesystem.
|
||||||
"
|
"
|
||||||
" a:path should be a dir
|
" a:path should be a dir
|
||||||
function! s:Path.isAncestor(path)
|
function! s:Path.isAncestor(child)
|
||||||
if !self.isDirectory
|
return a:child.isUnder(self)
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let this = self.str()
|
|
||||||
let that = a:path.str()
|
|
||||||
return stridx(that, this) ==# 0
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.isUnder(path) {{{1
|
" FUNCTION: Path.isUnder(path) {{{1
|
||||||
" return 1 if this path is somewhere under the given path in the filesystem.
|
" return 1 if this path is somewhere under the given path in the filesystem.
|
||||||
function! s:Path.isUnder(path)
|
function! s:Path.isUnder(parent)
|
||||||
if a:path.isDirectory ==# 0
|
if a:parent.isDirectory ==# 0
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
|
if nerdtree#runningWindows() && a:parent.drive !=# self.drive
|
||||||
let this = self.str()
|
return 0
|
||||||
let that = a:path.str()
|
endif
|
||||||
return stridx(this, that . s:Path.Slash()) ==# 0
|
let l:this_count = len(self.pathSegments)
|
||||||
|
if l:this_count ==# 0
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
let l:that_count = len(a:parent.pathSegments)
|
||||||
|
if l:that_count ==# 0
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
if l:that_count >= l:this_count
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
for i in range(0, l:that_count-1)
|
||||||
|
if self.pathSegments[i] !=# a:parent.pathSegments[i]
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.JoinPathStrings(...) {{{1
|
" FUNCTION: Path.JoinPathStrings(...) {{{1
|
||||||
|
|||||||
Reference in New Issue
Block a user