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:
parent
f526c4e652
commit
e0e36c5385
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user