Skip to content

Commit

Permalink
fix a bug with `:Bookmark foo' where foo was an existing bookmark
Browse files Browse the repository at this point in the history
  • Loading branch information
marty committed Jun 21, 2010
1 parent 153041a commit a997ab3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugin/NERD_tree.vim
Expand Up @@ -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
Expand Down

0 comments on commit a997ab3

Please sign in to comment.