mirror of
https://github.com/preservim/nerdtree.git
synced 2024-10-18 22:00:21 +03:00
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
This commit is contained in:
parent
1b17f945a3
commit
40ccf3cd45
@ -188,6 +188,7 @@ function! s:oTreeFileNode.ClearMarks() dict
|
|||||||
call remove(marks, i)
|
call remove(marks, i)
|
||||||
end
|
end
|
||||||
endfor
|
endfor
|
||||||
|
call self.path.CacheMarkNames()
|
||||||
endfunction
|
endfunction
|
||||||
"FUNCTION: oTreeFileNode.Copy(dest) {{{3
|
"FUNCTION: oTreeFileNode.Copy(dest) {{{3
|
||||||
function! s:oTreeFileNode.Copy(dest) dict
|
function! s:oTreeFileNode.Copy(dest) dict
|
||||||
@ -1404,7 +1405,18 @@ endfunction " >>>
|
|||||||
"FUNCTION: s:ClearAllMarks() {{{2
|
"FUNCTION: s:ClearAllMarks() {{{2
|
||||||
"delete all marks
|
"delete all marks
|
||||||
function! s:ClearAllMarks()
|
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
|
endfunction
|
||||||
"FUNCTION: s:GetNodeForMark(name, searchFromAbsoluteRoot) {{{2
|
"FUNCTION: s:GetNodeForMark(name, searchFromAbsoluteRoot) {{{2
|
||||||
"get the treenode for the mark with the given name
|
"get the treenode for the mark with the given name
|
||||||
@ -2609,10 +2621,19 @@ function! s:ClearMarks(marks)
|
|||||||
else
|
else
|
||||||
for name in split(a:marks, ' ')
|
for name in split(a:marks, ' ')
|
||||||
if count(keys(marks), name)
|
if count(keys(marks), name)
|
||||||
|
let node = {}
|
||||||
|
try
|
||||||
|
let node = s:GetNodeForMark(name, 1)
|
||||||
|
catch /NERDTree/
|
||||||
|
endtry
|
||||||
call remove(marks, name)
|
call remove(marks, name)
|
||||||
|
if !empty(node)
|
||||||
|
call node.path.CacheMarkNames()
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
call s:WriteMarks()
|
||||||
call s:RenderView()
|
call s:RenderView()
|
||||||
endfunction
|
endfunction
|
||||||
" FUNCTION: s:CloseChildren() {{{2
|
" FUNCTION: s:CloseChildren() {{{2
|
||||||
@ -2893,6 +2914,7 @@ function! s:MarkNode(name)
|
|||||||
if currentNode != {}
|
if currentNode != {}
|
||||||
let marks = s:GetMarks()
|
let marks = s:GetMarks()
|
||||||
let marks[a:name] = currentNode.path
|
let marks[a:name] = currentNode.path
|
||||||
|
call currentNode.path.CacheMarkNames()
|
||||||
call s:WriteMarks()
|
call s:WriteMarks()
|
||||||
call s:RenderView()
|
call s:RenderView()
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user