private void CreateAnchor()
 {
     if (this.document != null)
     {
         LineSegment lineSegment = this.document.GetLineSegment(Math.Max(0, Math.Min(this.location.Line, this.document.TotalNumberOfLines - 1)));
         this.anchor = lineSegment.CreateAnchor(Math.Max(0, Math.Min(this.location.Column, lineSegment.Length)));
         this.anchor.MovementType = AnchorMovementType.AfterInsertion;
         this.anchor.Deleted     += new EventHandler(this.AnchorDeleted);
     }
 }
 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;
     }
 }