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