From ebc206e58d959dd244ddbb82e5e784d51b6c2c6b Mon Sep 17 00:00:00 2001 From: Jason Franklin Date: Sun, 2 Jul 2017 12:03:45 -0400 Subject: [PATCH] Refactor "TreeDirNode.close()" method This method required adjustment to take cascades into consideration. Since the arrow in the NERDTree window reflects the status of the tail directory of the associated cascade, an arrow indicating open status can be present when a higher directory in the cascade was closed. This commit will automatically close child nodes within the same cascade of a closed directory node so that the arrow accurately reflects what is rendered. --- lib/nerdtree/tree_dir_node.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim index 19597f5..ac89c82 100644 --- a/lib/nerdtree/tree_dir_node.vim +++ b/lib/nerdtree/tree_dir_node.vim @@ -45,9 +45,14 @@ function! s:TreeDirNode.addChild(treenode, inOrder) endfunction " FUNCTION: TreeDirNode.close() {{{1 -" Closes this directory +" Mark this TreeDirNode as closed. function! s:TreeDirNode.close() - let self.isOpen = 0 + + " Close all directories in this directory node's cascade. This is + " necessary to ensure consistency when cascades are rendered. + for l:dirNode in self.getCascade() + let l:dirNode.isOpen = 0 + endfor endfunction " FUNCTION: TreeDirNode.closeChildren() {{{1