From 40ccf3cd4540c95390ad8b9e0c082cf0af21b59d Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Mon, 9 Jun 2008 22:04:31 +1200 Subject: [PATCH] make the mark manipulation funcs use the caching s:ClearMarks(), s:ClearAllMarks() and s:MarkNode() now use tell the relevant path objects to update their mark cache --- plugin/NERD_tree.vim | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index f97f6a5..5b68fcb 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -188,6 +188,7 @@ function! s:oTreeFileNode.ClearMarks() dict call remove(marks, i) end endfor + call self.path.CacheMarkNames() endfunction "FUNCTION: oTreeFileNode.Copy(dest) {{{3 function! s:oTreeFileNode.Copy(dest) dict @@ -1404,7 +1405,18 @@ endfunction " >>> "FUNCTION: s:ClearAllMarks() {{{2 "delete all marks function! s:ClearAllMarks() - let g:NERDTreeMarks = {} + for name in keys(g:NERDTreeMarks) + let node = {} + try + let node = s:GetNodeForMark(name, 1) + catch /NERDTree/ + endtry + call remove(g:NERDTreeMarks, name) + if !empty(node) + call node.path.CacheMarkNames() + endif + endfor + call s:WriteMarks() endfunction "FUNCTION: s:GetNodeForMark(name, searchFromAbsoluteRoot) {{{2 "get the treenode for the mark with the given name @@ -2609,10 +2621,19 @@ function! s:ClearMarks(marks) else for name in split(a:marks, ' ') if count(keys(marks), name) + let node = {} + try + let node = s:GetNodeForMark(name, 1) + catch /NERDTree/ + endtry call remove(marks, name) + if !empty(node) + call node.path.CacheMarkNames() + endif endif endfor endif + call s:WriteMarks() call s:RenderView() endfunction " FUNCTION: s:CloseChildren() {{{2 @@ -2893,6 +2914,7 @@ function! s:MarkNode(name) if currentNode != {} let marks = s:GetMarks() let marks[a:name] = currentNode.path + call currentNode.path.CacheMarkNames() call s:WriteMarks() call s:RenderView() else