commit a997ab3341596640ac0632e1a9e4192dff4516e0
parent 153041ac939502746e5a24468910eb7214a3f593
Author: marty <martin_grenfell@msn.com>
Date: Mon, 21 Jun 2010 21:41:52 +1200
fix a bug with `:Bookmark foo' where foo was an existing bookmark
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git 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