From 91dec8424b0363e9a3f6492fb9aae13ce12454a2 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Mon, 20 Feb 2006 16:22:21 +0000 Subject: [PATCH] Fixed SD2-695. Unsetting a breakpoint when viewing an xml document no longer leaves red text behind. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1169 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../XmlEditor/Project/Src/XmlEditorControl.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs index 8999199b7f..eaa947ebba 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs @@ -7,6 +7,7 @@ using ICSharpCode.Core; using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Bookmarks; using ICSharpCode.SharpDevelop.DefaultEditor; using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; using ICSharpCode.SharpDevelop.Gui; @@ -41,6 +42,8 @@ namespace ICSharpCode.XmlEditor Document.FoldingManager.FoldingStrategy = new XmlFoldingStrategy(); TextEditorProperties = new SharpDevelopTextEditorProperties(); + Document.BookmarkManager.Removed += new ICSharpCode.TextEditor.Document.BookmarkEventHandler(BookmarkRemoved); + GenerateEditActions(); } @@ -324,5 +327,23 @@ namespace ICSharpCode.XmlEditor ActiveTextAreaControl.TextArea.MotherTextEditorControl.EndUpdate(); } + + /// + /// Have to remove the bookmark from the document otherwise the text will + /// stay marked in red if the bookmark is a breakpoint. This is because + /// there are two bookmark managers, one in SharpDevelop itself and one + /// in the TextEditor library. By default, only the one in the text editor's + /// bookmark manager will be removed, so SharpDevelop will not know about it. + /// Removing it from the SharpDevelop BookMarkManager informs the debugger + /// service that the breakpoint has been removed so it triggers the removal + /// of the text marker. + /// + void BookmarkRemoved(object sender, ICSharpCode.TextEditor.Document.BookmarkEventArgs e) + { + ICSharpCode.SharpDevelop.Bookmarks.SDBookmark b = e.Bookmark as ICSharpCode.SharpDevelop.Bookmarks.SDBookmark; + if (b != null) { + ICSharpCode.SharpDevelop.Bookmarks.BookmarkManager.RemoveMark(b); + } + } } }