From a997ab3341596640ac0632e1a9e4192dff4516e0 Mon Sep 17 00:00:00 2001 From: marty Date: Mon, 21 Jun 2010 21:41:52 +1200 Subject: [PATCH] fix a bug with `:Bookmark foo' where foo was an existing bookmark --- plugin/NERD_tree.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 6411b1d2..667b8966 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -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