mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-26 10:14:20 +08:00
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
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user