Browse Source

create a new TextOutputLocation class for storing the location in the output text instead of Tuple<int, int> + fix build

pull/258/head
Eusebiu Marcu 14 years ago
parent
commit
5a892c30df
  1. 5
      ILSpy/Bookmarks/MemberBookmark.cs
  2. 2
      ILSpy/Languages/Language.cs
  3. 23
      ILSpy/TextView/AvalonEditTextOutput.cs

5
ILSpy/Bookmarks/MemberBookmark.cs

@ -21,6 +21,7 @@ using System.Windows; @@ -21,6 +21,7 @@ using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.TypeSystem;
using Mono.Cecil;
@ -91,9 +92,9 @@ namespace ICSharpCode.ILSpy.Bookmarks @@ -91,9 +92,9 @@ namespace ICSharpCode.ILSpy.Bookmarks
public int LineNumber {
get {
var t = node.Annotation<Tuple<int, int>>();
var t = node.Annotation<TextOutputLocation>();
if (t != null)
return t.Item1;
return t.Line;
return 0;
}
}

2
ILSpy/Languages/Language.cs

@ -207,7 +207,7 @@ namespace ICSharpCode.ILSpy @@ -207,7 +207,7 @@ namespace ICSharpCode.ILSpy
var nodes = TreeTraversal
.PreOrder((AstNode)builder.CompilationUnit, n => n.Children)
.Where(n => n is AttributedNode && n.Annotation<Tuple<int, int>>() != null);
.Where(n => n is AttributedNode && n.Annotation<TextOutputLocation>() != null);
OnDecompilationFinished(new DecompileEventArgs {
CodeMappings = builder.CodeMappings,

23
ILSpy/TextView/AvalonEditTextOutput.cs

@ -65,7 +65,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -65,7 +65,7 @@ namespace ICSharpCode.ILSpy.TextView
/// </summary>
public sealed class AvalonEditTextOutput : ISmartTextOutput
{
int lineNumber = 1;
TextOutputLocation location = new TextOutputLocation { Line = 1, Column = 1 };
int lastLineStart = 0;
readonly StringBuilder b = new StringBuilder();
@ -117,6 +117,13 @@ namespace ICSharpCode.ILSpy.TextView @@ -117,6 +117,13 @@ namespace ICSharpCode.ILSpy.TextView
get { return b.Length; }
}
public TextOutputLocation Location {
get {
location.Column = b.Length - lastLineStart + 1;
return location;
}
}
#region Text Document
TextDocument textDocument;
@ -188,7 +195,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -188,7 +195,7 @@ namespace ICSharpCode.ILSpy.TextView
b.AppendLine();
needsIndent = true;
lastLineStart = b.Length;
lineNumber++;
location.Line++;
if (this.TextLength > LengthLimit) {
throw new OutputLengthExceededException();
}
@ -236,17 +243,5 @@ namespace ICSharpCode.ILSpy.TextView @@ -236,17 +243,5 @@ namespace ICSharpCode.ILSpy.TextView
this.UIElements.Add(new KeyValuePair<int, Lazy<UIElement>>(this.TextLength, new Lazy<UIElement>(element)));
}
}
public int CurrentLine {
get {
return lineNumber;
}
}
public int CurrentColumn {
get {
return b.Length - lastLineStart + 1;
}
}
}
}

Loading…
Cancel
Save