commit 600f2cac14603c339270706f147b0ae193defd78
parent fb3c4f9212d356c7a0e3b96e5dabcfa1152d4a99
Author: Martin Grenfell <martin_grenfell@msn.com>
Date: Fri, 6 Jun 2008 13:21:55 +1200
make PutCursorOnNode open ancestors until target node is visible
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2072,8 +2072,14 @@ function! s:PutCursorOnNode(treenode, isJump, recurseUpward)
endif
call cursor(ln, col("."))
else
- if a:recurseUpward && a:treenode.parent != {}
- call s:PutCursorOnNode(a:treenode.parent, a:isJump, 1)
+ if a:recurseUpward
+ let node = a:treenode
+ while s:FindNodeLineNumber(node) == -1 && node != {}
+ let node = node.parent
+ call node.Open()
+ endwhile
+ call s:RenderView()
+ call s:PutCursorOnNode(a:treenode, a:isJump, 0)
endif
endif
endfunction