diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs index e177e8bcd8..bf7b279c93 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditor.cs @@ -51,7 +51,7 @@ namespace ICSharpCode.AvalonEdit.AddIn CodeEditorAdapter secondaryTextEditorAdapter; readonly IconBarManager iconBarManager; readonly TextMarkerService textMarkerService; - readonly ErrorPainter errorPainter; + ErrorPainter errorPainter; BracketHighlightRenderer primaryBracketRenderer; BracketHighlightRenderer secondaryBracketRenderer; @@ -117,6 +117,11 @@ namespace ICSharpCode.AvalonEdit.AddIn if (secondaryTextEditorAdapter != null) secondaryTextEditorAdapter.FileNameChanged(); + if (this.errorPainter != null) + this.errorPainter.Dispose(); + + this.errorPainter = new ErrorPainter(primaryTextEditorAdapter); + FetchParseInformation(); } } @@ -141,8 +146,6 @@ namespace ICSharpCode.AvalonEdit.AddIn primaryTextEditorAdapter = (CodeEditorAdapter)primaryTextEditor.TextArea.GetService(typeof(ITextEditor)); Debug.Assert(primaryTextEditorAdapter != null); - this.errorPainter = new ErrorPainter(primaryTextEditorAdapter); - this.primaryBracketRenderer = new BracketHighlightRenderer(primaryTextEditor.TextArea.TextView); this.Document = primaryTextEditor.Document; @@ -527,7 +530,8 @@ namespace ICSharpCode.AvalonEdit.AddIn if (secondaryTextEditorAdapter != null) secondaryTextEditorAdapter.Language.Detach(); - errorPainter.Dispose(); + if (errorPainter != null) + errorPainter.Dispose(); this.Document = null; } } diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs index 5c58802e1a..1373eb9f79 100644 --- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs +++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/TextMarkerService.cs @@ -169,7 +169,7 @@ namespace ICSharpCode.AvalonEdit.AddIn case TextMarkerType.SquigglyUnderline: double offset = 2.5; - int count = (int)((endPoint.X - startPoint.X) / offset) + 1; + int count = Math.Max((int)((endPoint.X - startPoint.X) / offset) + 1, 4); StreamGeometry geometry = new StreamGeometry(); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/AXmlParser.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/AXmlParser.cs index e073b2b420..4c96f98922 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/AXmlParser.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/AXmlParser.cs @@ -128,6 +128,7 @@ namespace ICSharpCode.AvalonEdit.Xml } } + [Conditional("DEBUG")] internal static void Log(string text, params object[] pars) { System.Diagnostics.Debug.WriteLine(string.Format("XML: " + text, pars)); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TrackedSegmentCollection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TrackedSegmentCollection.cs index 767041796f..7aebb3160d 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TrackedSegmentCollection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TrackedSegmentCollection.cs @@ -69,7 +69,8 @@ namespace ICSharpCode.AvalonEdit.Xml /// Add object to cache, optionally adding extra memory tracking public void AddParsedObject(AXmlObject obj, int? maxTouchedLocation) { - AXmlParser.Assert(obj.Length > 0 || obj is AXmlDocument, string.Format("Invalid object {0}. It has zero length.", obj)); + if (!(obj.Length > 0 || obj is AXmlDocument)) + AXmlParser.Assert(false, string.Format("Invalid object {0}. It has zero length.", obj)); // // Expensive check // if (obj is AXmlContainer) { // int objStartOffset = obj.StartOffset; diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs index 3ab801e6f3..bb9c3f203c 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/DefaultDocument.cs @@ -40,7 +40,7 @@ namespace ICSharpCode.TextEditor.Document /// /// The indentation from the line above will be - /// taken to indent the curent line + /// taken to indent the current line /// Auto, diff --git a/src/Main/Base/Project/Src/Services/Tasks/ErrorPainter.cs b/src/Main/Base/Project/Src/Services/Tasks/ErrorPainter.cs index ccfdf562d9..ad2d39e469 100644 --- a/src/Main/Base/Project/Src/Services/Tasks/ErrorPainter.cs +++ b/src/Main/Base/Project/Src/Services/Tasks/ErrorPainter.cs @@ -33,6 +33,8 @@ namespace ICSharpCode.SharpDevelop TaskService.Cleared += new EventHandler(OnCleared); DebuggerService.DebugStarted += OnDebugStarted; DebuggerService.DebugStopped += OnDebugStopped; + + UpdateErrors(); } bool isDisposed;