Browse Source

Fixed ArgumentOutOfRangeException in CodeCoverageControl.OpenFile (http://community.sharpdevelop.net/forums/t/12456.aspx).

pull/14/head
Daniel Grunwald 15 years ago
parent
commit
2a5459a0b9
  1. 6
      src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageControl.cs
  2. 5
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs

6
src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageControl.cs

@ -240,7 +240,7 @@ namespace ICSharpCode.CodeCoverage @@ -240,7 +240,7 @@ namespace ICSharpCode.CodeCoverage
CodeCoverageSequencePoint sequencePoint = methodNode.Method.SequencePoints[0];
if (sequencePoint.HasDocument()) {
if (classNode == null) {
OpenFile(sequencePoint.Document, sequencePoint.Line - 1, sequencePoint.Column - 1);
OpenFile(sequencePoint.Document, sequencePoint.Line, sequencePoint.Column);
} else {
OpenFile(sequencePoint.Document, 1, 1);
}
@ -310,8 +310,8 @@ namespace ICSharpCode.CodeCoverage @@ -310,8 +310,8 @@ namespace ICSharpCode.CodeCoverage
textEditor.Load(fileName);
}
textEditor.ScrollToEnd();
textEditor.TextArea.Caret.Line = line - 1;
textEditor.ScrollToLine(line - 1);
textEditor.TextArea.Caret.Location = new ICSharpCode.AvalonEdit.Document.TextLocation(line, column);
textEditor.ScrollToLine(line);
CodeCoverageService.ShowCodeCoverage(new AvalonEditTextEditorAdapter(textEditor), fileName);
}

5
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/TextEditor.cs

@ -1102,6 +1102,11 @@ namespace ICSharpCode.AvalonEdit @@ -1102,6 +1102,11 @@ namespace ICSharpCode.AvalonEdit
TextView textView = textArea.TextView;
TextDocument document = textView.Document;
if (scrollViewer != null && document != null) {
if (line < 1)
line = 1;
if (line > document.LineCount)
line = document.LineCount;
IScrollInfo scrollInfo = textView;
if (!scrollInfo.CanHorizontallyScroll) {
// Word wrap is enabled. Ensure that we have up-to-date info about line height so that we scroll

Loading…
Cancel
Save