From 600f2cac14603c339270706f147b0ae193defd78 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Fri, 6 Jun 2008 13:21:55 +1200 Subject: [PATCH] make PutCursorOnNode open ancestors until target node is visible --- plugin/NERD_tree.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 8cbd9a8..b1e7fd1 100644 --- 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