put cursor on new node after copying

This commit is contained in:
Martin Grenfell 2008-06-03 22:01:41 +12:00
parent b747086137
commit a520080cc3

View File

@ -169,10 +169,11 @@ endfunction
function! s:oTreeFileNode.Copy(dest) dict
call self.path.Copy(a:dest)
let newPath = s:oPath.New(a:dest)
let parentNode = t:NERDTreeRoot.FindNode(newPath.GetParent())
if !empty(parentNode)
call parentNode.Refresh()
let parent = t:NERDTreeRoot.FindNode(newPath.GetParent())
if !empty(parent)
call parent.Refresh()
endif
return parent.FindNode(newPath)
endfunction
"FUNCTION: oTreeFileNode.Delete {{{3
@ -2507,12 +2508,13 @@ function! s:CopyNode()
if confirmed
try
call currentNode.Copy(newNodePath)
let newNode = currentNode.Copy(newNodePath)
call s:RenderView()
call s:PutCursorOnNode(newNode, 0)
catch /^NERDTree/
call s:EchoWarning("Could not copy node")
endtry
endif
call s:RenderView()
else
call s:Echo("Copy aborted.")
endif