mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 03:43:50 -05:00
move a method into the TreeDirNode model
This commit is contained in:
@@ -282,7 +282,7 @@ endfunction
|
|||||||
" searchFromAbsoluteRoot: specifies whether we should search from the current
|
" searchFromAbsoluteRoot: specifies whether we should search from the current
|
||||||
" tree root, or the highest cached node
|
" tree root, or the highest cached node
|
||||||
function! s:oBookmark.getNode(searchFromAbsoluteRoot)
|
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)
|
let targetNode = searchRoot.findNode(self.path)
|
||||||
if empty(targetNode)
|
if empty(targetNode)
|
||||||
throw "NERDTree.BookmarkedNodeNotFound no node was found for bookmark: " . self.name
|
throw "NERDTree.BookmarkedNodeNotFound no node was found for bookmark: " . self.name
|
||||||
@@ -612,6 +612,15 @@ endfunction
|
|||||||
"classes.
|
"classes.
|
||||||
"============================================================
|
"============================================================
|
||||||
let s:oTreeDirNode = copy(s:oTreeFileNode)
|
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
|
"FUNCTION: oTreeDirNode.addChild(treenode, inOrder) {{{3
|
||||||
"Adds the given treenode to the list of children for this node
|
"Adds the given treenode to the list of children for this node
|
||||||
"
|
"
|
||||||
@@ -1615,15 +1624,6 @@ function! s:Abs(num)
|
|||||||
return 0 - a:num
|
return 0 - a:num
|
||||||
end
|
end
|
||||||
endfunction
|
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
|
"FUNCTION: s:BufInWindows(bnum){{{2
|
||||||
"[[STOLEN FROM VTREEEXPLORER.VIM]]
|
"[[STOLEN FROM VTREEEXPLORER.VIM]]
|
||||||
"Determine the number of windows open to this buffer number.
|
"Determine the number of windows open to this buffer number.
|
||||||
|
|||||||
Reference in New Issue
Block a user