nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit ebc206e58d959dd244ddbb82e5e784d51b6c2c6b
parent 86605413339960e0f32e5197d1d38b547bf141cf
Author: Jason Franklin <j_fra@fastmail.us>
Date:   Sun,  2 Jul 2017 12:03:45 -0400

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.

Diffstat:
Mlib/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
@@ -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