Fix a problem with the "x" handler (#768)

Pressing "x" on a cascade could close the root of the tree.  This
commit prevents that from happening.
This commit is contained in:
Jason Franklin
2017-11-18 10:55:43 -05:00
committed by GitHub
parent f526c4e652
commit e0e36c5385

View File

@@ -194,15 +194,15 @@ function! s:closeCurrentDir(node)
let l:parent = a:node.parent
if empty(l:parent) || l:parent.isRoot()
call nerdtree#echo('cannot close tree root')
return
endif
while l:parent.isCascadable()
let l:parent = l:parent.parent
endwhile
if l:parent.isRoot()
call nerdtree#echo('cannot close tree root')
return
endif
call l:parent.close()
call b:NERDTree.render()
call l:parent.putCursorHere(0, 0)