void CreateAnchor() { if (document != null) { LineSegment line = document.GetLineSegment(Math.Max(0, Math.Min(location.Line, document.TotalNumberOfLines-1))); anchor = line.CreateAnchor(Math.Max(0, Math.Min(location.Column, line.Length))); // after insertion: keep bookmarks after the initial whitespace (see DefaultFormattingStrategy.SmartReplaceLine) anchor.MovementType = AnchorMovementType.AfterInsertion; anchor.Deleted += AnchorDeleted; } }
public void AddDeletedAnchor(TextAnchor anchor) { if (textAnchor == null) textAnchor = new List<TextAnchor>(); textAnchor.Add(anchor); }
void AddAnchor(TextAnchor anchor) { Debug.Assert(anchor.Line == this); if (anchors == null) anchors = new Util.WeakCollection<TextAnchor>(); anchors.Add(anchor); }
public TextAnchor CreateAnchor(int column) { if (column < 0 || column > Length) throw new ArgumentOutOfRangeException("column"); TextAnchor anchor = new TextAnchor(this, column); AddAnchor(anchor); return anchor; }