fix a bug with `:Bookmark foo' where foo was an existing bookmark
This commit is contained in:
parent
153041ac93
commit
a997ab3341
@ -806,15 +806,23 @@ endfunction
|
|||||||
"FUNCTION: TreeFileNode.bookmark(name) {{{3
|
"FUNCTION: TreeFileNode.bookmark(name) {{{3
|
||||||
"bookmark this node with a:name
|
"bookmark this node with a:name
|
||||||
function! s:TreeFileNode.bookmark(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
|
try
|
||||||
let oldMarkedNode = s:Bookmark.GetNodeForName(a:name, 1)
|
let oldMarkedNode = s:Bookmark.GetNodeForName(a:name, 1)
|
||||||
call oldMarkedNode.path.cacheDisplayString()
|
|
||||||
catch /^NERDTree.BookmarkNotFoundError/
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
|
catch /^NERDTree.BookmarkedNodeNotFoundError/
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
call s:Bookmark.AddBookmark(a:name, self.path)
|
call s:Bookmark.AddBookmark(a:name, self.path)
|
||||||
call self.path.cacheDisplayString()
|
call self.path.cacheDisplayString()
|
||||||
call s:Bookmark.Write()
|
call s:Bookmark.Write()
|
||||||
|
|
||||||
|
if !empty(oldMarkedNode)
|
||||||
|
call oldMarkedNode.path.cacheDisplayString()
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
"FUNCTION: TreeFileNode.cacheParent() {{{3
|
"FUNCTION: TreeFileNode.cacheParent() {{{3
|
||||||
"initializes self.parent if it isnt already
|
"initializes self.parent if it isnt already
|
||||||
|
Loading…
x
Reference in New Issue
Block a user