fix a bug with `:Bookmark foo' where foo was an existing bookmark

This commit is contained in:
marty 2010-06-21 21:41:52 +12:00
parent 153041ac93
commit a997ab3341

View File

@ -806,15 +806,23 @@ endfunction
"FUNCTION: TreeFileNode.bookmark(name) {{{3
"bookmark this node with a:name
function! s:TreeFileNode.bookmark(name)
"if a bookmark exists with the same name and the node is cached then save
"it so we can update its display string
let oldMarkedNode = {}
try
let oldMarkedNode = s:Bookmark.GetNodeForName(a:name, 1)
call oldMarkedNode.path.cacheDisplayString()
catch /^NERDTree.BookmarkNotFoundError/
catch /^NERDTree.BookmarkedNodeNotFoundError/
endtry
call s:Bookmark.AddBookmark(a:name, self.path)
call self.path.cacheDisplayString()
call s:Bookmark.Write()
if !empty(oldMarkedNode)
call oldMarkedNode.path.cacheDisplayString()
endif
endfunction
"FUNCTION: TreeFileNode.cacheParent() {{{3
"initializes self.parent if it isnt already