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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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