diff options
author | Kirill Osenkov <github@osenkov.com> | 2018-05-05 03:14:41 +0300 |
---|---|---|
committer | Kirill Osenkov <github@osenkov.com> | 2018-05-05 03:14:41 +0300 |
commit | 9eca7e7ce0d49becaaeb53fb705125ef4ed87b94 (patch) | |
tree | 5f6c0ab97aaa3c6bf8c55b447e6255b86cce0bcd | |
parent | 4d081f739add0fab9c4ef2aa822a417c242e207b (diff) |
Surround the problematic code in TextViewMargin.SpanUpdateListener w try/catch.
-rw-r--r-- | main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.SpanUpdateListener.cs | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.SpanUpdateListener.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.SpanUpdateListener.cs index f0700ee6ee..3bc3227d5a 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.SpanUpdateListener.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.SpanUpdateListener.cs @@ -75,10 +75,14 @@ namespace Mono.TextEditor void Document_TextChanging (object sender, TextChangeEventArgs e) { - HasUpdatedMultilineSpan = false; - foreach (var change in e.TextChanges) { - var layout = textEditor.TextViewMargin.GetLayout (textEditor.GetLineByOffset (change.Offset)); - lines.Add (layout.HighlightedLine); + try { + HasUpdatedMultilineSpan = false; + foreach (var change in e.TextChanges) { + var layout = textEditor.TextViewMargin.GetLayout (textEditor.GetLineByOffset (change.Offset)); + lines.Add (layout.HighlightedLine); + } + } + catch { } } @@ -86,15 +90,20 @@ namespace Mono.TextEditor { int i = 0; - foreach (var change in e.TextChanges) { - if (i >= lines.Count) - break; // should never happen - var oldHighlightedLine = lines [i++]; - var curLine = textEditor.GetLineByOffset (change.Offset); - var curLayout = textEditor.TextViewMargin.GetLayout (curLine); - if (!UpdateLineHighlight (curLine.LineNumber, oldHighlightedLine, curLayout.HighlightedLine)) - break; + try { + foreach (var change in e.TextChanges) { + if (i >= lines.Count) + break; // should never happen + var oldHighlightedLine = lines[i++]; + var curLine = textEditor.GetLineByOffset (change.Offset); + var curLayout = textEditor.TextViewMargin.GetLayout (curLine); + if (!UpdateLineHighlight (curLine.LineNumber, oldHighlightedLine, curLayout.HighlightedLine)) + break; + } + } + catch { } + lines.Clear (); } |