コード例 #1
0
 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 += OnAnchorDeleted;
   }
 }
コード例 #2
0
        void AddAnchor(TextAnchor anchor)
        {
            Debug.Assert(anchor.Line == this);

              if (_anchors == null)
            _anchors = new Utilities.WeakCollection<TextAnchor>();

              _anchors.Add(anchor);
        }
コード例 #3
0
        /// <summary>
        /// Creates a new anchor in the current line.
        /// </summary>
        /// <param name="column">The column.</param>
        /// <returns>The <see cref="TextAnchor"/>.</returns>
        public TextAnchor CreateAnchor(int column)
        {
            if (column < 0 || column > Length)
            throw new ArgumentOutOfRangeException("column");

              TextAnchor anchor = new TextAnchor(this, column);
              AddAnchor(anchor);
              return anchor;
        }
コード例 #4
0
		public void AddDeletedAnchor(TextAnchor anchor)
		{
      if (_removedAnchors == null)
        _removedAnchors = new List<TextAnchor>();
      _removedAnchors.Add(anchor);
		}
コード例 #5
0
 /// <summary>
 /// Creates a new anchor in the current line.
 /// </summary>
 /// <param name="column">The column.</param>
 /// <returns>The <see cref="TextAnchor"/>.</returns>
 public TextAnchor CreateAnchor(int column)
 {
   TextAnchor anchor = new TextAnchor(this, column);
   AddAnchor(anchor);
   return anchor;
 }