From b0a2f1ae602db94886b40a45bb912a1f901a5418 Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Sat, 18 Nov 2017 10:53:59 -0500 Subject: [PATCH] Fix a problem with the "x" handler Pressing "x" on a cascade could close the root of the tree. This commit prevents that from happening. --- autoload/nerdtree/ui_glue.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index 79292356..93ac5675 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -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)