예제 #1
0
        /// <summary>
        /// Is called after a newline was inserted into this line, splitting it into this and followingLine.
        /// </summary>
        internal void SplitTo(LineSegment followingLine)
        {
            if (anchors != null)
            {
                List <TextAnchor> movedAnchors = null;
                foreach (TextAnchor a in anchors)
                {
                    if (a.ColumnNumber > this.Length)
                    {
                        a.Line = followingLine;
                        followingLine.AddAnchor(a);
                        a.ColumnNumber -= this.Length;

                        if (movedAnchors == null)
                        {
                            movedAnchors = new List <TextAnchor>();
                        }
                        movedAnchors.Add(a);
                    }
                }
                if (movedAnchors != null)
                {
                    foreach (TextAnchor a in movedAnchors)
                    {
                        anchors.Remove(a);
                    }
                }
            }
        }
        /// <summary>
        /// Splits the <see cref="TextAnchor"/>s of a line if a newline is inserted.
        /// </summary>
        /// <param name="followingLine">The following line.</param>
        internal void SplitTo(LineSegment followingLine)
        {
            // Is called after a newline was inserted into this line, splitting it into this and followingLine.

            if (_anchors != null)
            {
                List <TextAnchor> movedAnchors = null;
                foreach (TextAnchor anchor in _anchors)
                {
                    if (anchor.MovementType == AnchorMovementType.BeforeInsertion
              ? anchor.ColumnNumber > Length
              : anchor.ColumnNumber >= Length)
                    {
                        anchor.Line = followingLine;
                        followingLine.AddAnchor(anchor);
                        anchor.ColumnNumber -= Length;

                        if (movedAnchors == null)
                        {
                            movedAnchors = new List <TextAnchor>();
                        }
                        movedAnchors.Add(anchor);
                    }
                }

                if (movedAnchors != null)
                {
                    foreach (TextAnchor a in movedAnchors)
                    {
                        _anchors.Remove(a);
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Splits the <see cref="TextAnchor"/>s of a line if a newline is inserted.
        /// </summary>
        /// <param name="followingLine">The following line.</param>
        internal void SplitTo(LineSegment followingLine)
        {
            // Is called after a newline was inserted into this line, splitting it into this and followingLine.

              if (_anchors != null)
              {
            List<TextAnchor> movedAnchors = null;
            foreach (TextAnchor anchor in _anchors)
            {
              if (anchor.MovementType == AnchorMovementType.BeforeInsertion
              ? anchor.ColumnNumber > Length
              : anchor.ColumnNumber >= Length)
              {
            anchor.Line = followingLine;
            followingLine.AddAnchor(anchor);
            anchor.ColumnNumber -= Length;

            if (movedAnchors == null)
              movedAnchors = new List<TextAnchor>();
            movedAnchors.Add(anchor);
              }
            }

            if (movedAnchors != null)
              foreach (TextAnchor a in movedAnchors)
            _anchors.Remove(a);
              }
        }
    /// <summary>
    /// Is called after a newline was inserted into this line, splitting it into this and followingLine.
    /// </summary>
    internal void SplitTo(LineSegment followingLine)
    {
      if (anchors != null)
      {
        List<TextAnchor> movedAnchors = null;
        foreach (TextAnchor a in anchors)
        {
          if (a.ColumnNumber > this.Length)
          {
            a.Line = followingLine;
            followingLine.AddAnchor(a);
            a.ColumnNumber -= this.Length;

            if (movedAnchors == null)
              movedAnchors = new List<TextAnchor>();
            movedAnchors.Add(a);
          }
        }
        if (movedAnchors != null)
        {
          foreach (TextAnchor a in movedAnchors)
          {
            anchors.Remove(a);
          }
        }
      }
    }