Skip to content

Commit

Permalink
Remove Editor folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
eusebiu committed Feb 17, 2011
1 parent 71c292d commit cd1a232
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 83 deletions.
81 changes: 4 additions & 77 deletions Debugger/ILSpy.Debugger/Bookmarks/BookmarkBase.cs
Expand Up @@ -21,7 +21,6 @@
using System.Windows.Media;

using ICSharpCode.NRefactory.CSharp;
using ILSpy.Debugger.AvalonEdit.Editor;

namespace ILSpy.Debugger.Bookmarks
{
Expand All @@ -32,76 +31,14 @@ public class BookmarkBase : IBookmark
{
AstLocation location;

IDocument document;
ITextAnchor anchor;

public IDocument Document {
get {
return document;
}
set {
if (document != value) {
if (anchor != null) {
location = anchor.Location;
anchor = null;
}
document = value;
CreateAnchor();
OnDocumentChanged(EventArgs.Empty);
}
}
}

void CreateAnchor()
{
if (document != null) {
int lineNumber = Math.Max(1, Math.Min(location.Line, document.TotalNumberOfLines));
int lineLength = document.GetLine(lineNumber).Length;
int offset = document.PositionToOffset(
lineNumber,
Math.Max(1, Math.Min(location.Column, lineLength + 1))
);
anchor = document.CreateAnchor(offset);
// after insertion: keep bookmarks after the initial whitespace (see DefaultFormattingStrategy.SmartReplaceLine)
anchor.MovementType = AnchorMovementType.AfterInsertion;
anchor.Deleted += AnchorDeleted;
} else {
anchor = null;
}
}

void AnchorDeleted(object sender, EventArgs e)
{
// the anchor just became invalid, so don't try to use it again
location = AstLocation.Empty;
anchor = null;
RemoveMark();
}

protected virtual void RemoveMark()
{

}

/// <summary>
/// Gets the TextAnchor used for this bookmark.
/// Is null if the bookmark is not connected to a document.
/// </summary>
public ITextAnchor Anchor {
get { return anchor; }
}

public AstLocation Location {
get {
if (anchor != null)
return anchor.Location;
else
return location;
}
set {
location = value;
CreateAnchor();
}
get { return location; }
set { location = value; }
}

public event EventHandler DocumentChanged;
Expand All @@ -121,21 +58,11 @@ protected virtual void Redraw()
public string TypeName { get; set; }

public int LineNumber {
get {
if (anchor != null)
return anchor.Line;
else
return location.Line;
}
get { return location.Line; }
}

public int ColumnNumber {
get {
if (anchor != null)
return anchor.Column;
else
return location.Column;
}
get { return location.Column; }
}

public virtual int ZOrder {
Expand Down
6 changes: 0 additions & 6 deletions Debugger/ILSpy.Debugger/ILSpy.Debugger.csproj
Expand Up @@ -53,12 +53,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AvalonEdit\TextEditorWeakEventManager.cs" />
<Compile Include="AvalonEdit\Editor\AvalonEditTextSourceAdapter.cs" />
<Compile Include="AvalonEdit\Editor\IDocument.cs" />
<Compile Include="AvalonEdit\Editor\IDocumentLine.cs" />
<Compile Include="AvalonEdit\Editor\ITextAnchor.cs" />
<Compile Include="AvalonEdit\Editor\ITextBuffer.cs" />
<Compile Include="AvalonEdit\Editor\TextChangeEventArgs.cs" />
<Compile Include="AvalonEdit\IconBarMargin.cs" />
<Compile Include="AvalonEdit\IToolTip.cs" />
<Compile Include="Bookmarks\BookmarkBase.cs" />
Expand Down

0 comments on commit cd1a232

Please sign in to comment.