
Hi,
I'm using the built-in bookmark indicator.
A bookmark is automatically removed when a line is deleted and this behivior is good for out product.
Please tell me how to detect automatic removal of a bookmark. Is there an event to do this?
Hi,
I'm using the built-in bookmark indicator.
A bookmark is automatically removed when a line is deleted and this behivior is good for out product.
Please tell me how to detect automatic removal of a bookmark. Is there an event to do this?
Hello,
The only way to track that is to get the tagger that tracks the bookmark indicators and to watch its TagsChanged event. The tricky thing about that is that it's lazily created only when a bookmark is first added to the document. It's not available until after that.
This sort of code could be run the first time a bookmark is added to the document:
BookmarkIndicatorTagger tagger;
if (editor.Document.Properties.TryGetValue(typeof(BookmarkIndicatorTagger), out tagger))
tagger.TagsChanged += BookmarkIndicatorTagger_TagsChanged;
TagsChanged will be fired whenever tags change over a region specified by the event args. Note the event won't tell you which tags are removed, but you'd at least know the range to examine again to see if something is removed.
Thank you! Will TagsChanged occur also when a bookmark is automatically removed by deleting a line on the editor?
Yes, any event that affects the tag range should fire the event.
Thank you.
Please log in to a validated account to post comments.