commit 888934a3beb5ef69d90664c74eea0d96bfbfd087 parent fb5ee9fbc2b913d5ec9ade44da391728dc4723a6 Author: Martin Grenfell <martin_grenfell@msn.com> Date: Sun, 14 Dec 2008 00:40:17 +1300 make TreeFileNode#isRoot() assume a tree exists for current buf, not tab Diffstat:
| M | plugin/NERD_tree.vim | | | 10 | ++++++++-- |
1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim @@ -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()
