From e102abe98f343f6f7d061631fb73240e75ba0fa6 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Wed, 3 Sep 2008 16:32:14 +1200 Subject: [PATCH] move a method into the TreeDirNode model --- plugin/NERD_tree.vim | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index fea9ff2..bc699ad 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -282,7 +282,7 @@ endfunction " searchFromAbsoluteRoot: specifies whether we should search from the current " tree root, or the highest cached node function! s:oBookmark.getNode(searchFromAbsoluteRoot) - let searchRoot = a:searchFromAbsoluteRoot ? s:AbsoluteTreeRoot() : t:NERDTreeRoot + let searchRoot = a:searchFromAbsoluteRoot ? s:oTreeDirNode.AbsoluteTreeRoot() : t:NERDTreeRoot let targetNode = searchRoot.findNode(self.path) if empty(targetNode) throw "NERDTree.BookmarkedNodeNotFound no node was found for bookmark: " . self.name @@ -612,6 +612,15 @@ endfunction "classes. "============================================================ let s:oTreeDirNode = copy(s:oTreeFileNode) +"FUNCTION: s:oTreeDirNode.AbsoluteTreeRoot(){{{2 +"class method that returns the highest cached ancestor of the current root +function! s:oTreeDirNode.AbsoluteTreeRoot() + let currentNode = t:NERDTreeRoot + while currentNode.parent != {} + let currentNode = currentNode.parent + endwhile + return currentNode +endfunction "FUNCTION: oTreeDirNode.addChild(treenode, inOrder) {{{3 "Adds the given treenode to the list of children for this node " @@ -1615,15 +1624,6 @@ function! s:Abs(num) return 0 - a:num end endfunction -"FUNCTION: s:AbsoluteTreeRoot(){{{2 -" returns the highest cached ancestor of the current root -function! s:AbsoluteTreeRoot() - let currentNode = t:NERDTreeRoot - while currentNode.parent != {} - let currentNode = currentNode.parent - endwhile - return currentNode -endfunction "FUNCTION: s:BufInWindows(bnum){{{2 "[[STOLEN FROM VTREEEXPLORER.VIM]] "Determine the number of windows open to this buffer number.