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.
This commit is contained in:
Jason Franklin 2017-07-02 12:03:45 -04:00
parent 8660541333
commit ebc206e58d

View File

@ -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