make TreeFileNode#isRoot() assume a tree exists for current buf, not tab

This commit is contained in:
Martin Grenfell 2008-12-14 00:40:17 +13:00
parent fb5ee9fbc2
commit 888934a3be

View File

@ -593,9 +593,10 @@ endfunction
"FUNCTION: TreeFileNode.isRoot() {{{3
"returns 1 if this node is b:NERDTreeRoot
function! s:TreeFileNode.isRoot()
if !s:treeExistsForTab()
throw "NERDTree.TreeFileNode.IsRoot exception: No tree exists for the current tab"
if !s:treeExistsForBuf()
throw "NERDTree.NoTreeError: No tree exists for the current buffer"
endif
return self.equals(b:NERDTreeRoot)
endfunction
@ -1794,6 +1795,11 @@ function! s:initNerdTreeInPlace(dir)
call s:renderView()
endfunction
" Function: s:treeExistsForBuffer() {{{2
" Returns 1 if a nerd tree root exists in the current buffer
function! s:treeExistsForBuf()
return exists("b:NERDTreeRoot")
endfunction
" Function: s:treeExistsForTab() {{{2
" Returns 1 if a nerd tree root exists in the current tab
function! s:treeExistsForTab()