mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
fix a bug when overwriting an existing bookmark
if the bookmark wasnt cached in the tree an exception was being thrown that wasnt caught
This commit is contained in:
@@ -243,7 +243,7 @@ function! s:oBookmark.Delete() dict
|
||||
let node = {}
|
||||
try
|
||||
let node = self.GetNode(1)
|
||||
catch /NERDTree.BookmarkNodeNotFound/
|
||||
catch /NERDTree.BookmarkNotFound/
|
||||
endtry
|
||||
call remove(s:oBookmark.Bookmarks(), index(s:oBookmark.Bookmarks(), self))
|
||||
if !empty(node)
|
||||
@@ -260,7 +260,7 @@ function! s:oBookmark.GetNode(searchFromAbsoluteRoot) dict
|
||||
let searchRoot = a:searchFromAbsoluteRoot ? s:AbsoluteTreeRoot() : t:NERDTreeRoot
|
||||
let targetNode = searchRoot.FindNode(self.path)
|
||||
if empty(targetNode)
|
||||
throw "NERDTree.BookmarkNodeNotFound no node was found for bookmark: " . self.name
|
||||
throw "NERDTree.BookmarkNotFound no node was found for bookmark: " . self.name
|
||||
endif
|
||||
return targetNode
|
||||
endfunction
|
||||
@@ -2810,7 +2810,7 @@ endfunction
|
||||
function! s:BookmarkToRoot(name)
|
||||
try
|
||||
let targetNode = s:oBookmark.GetNodeForName(a:name, 1)
|
||||
catch /NERDTree.BookmarkNodeNotFound/
|
||||
catch /NERDTree.BookmarkNotFound/
|
||||
let targetNode = s:oTreeFileNode.New(s:oBookmark.BookmarkFor(a:name).path)
|
||||
endtry
|
||||
call targetNode.MakeRoot()
|
||||
|
||||
Reference in New Issue
Block a user