Exemple #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)
        {
            //Console.WriteLine("SplitTo");

            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);
                    }
                }
            }
        }
 internal void SplitTo(LineSegment followingLine)
 {
     if (this.anchors != null)
     {
         List <TextAnchor> textAnchors = null;
         foreach (TextAnchor anchor in this.anchors)
         {
             if ((anchor.MovementType == AnchorMovementType.BeforeInsertion ? anchor.ColumnNumber <= this.Length : anchor.ColumnNumber < this.Length))
             {
                 continue;
             }
             anchor.Line = followingLine;
             followingLine.AddAnchor(anchor);
             TextAnchor columnNumber = anchor;
             columnNumber.ColumnNumber = columnNumber.ColumnNumber - this.Length;
             if (textAnchors == null)
             {
                 textAnchors = new List <TextAnchor>();
             }
             textAnchors.Add(anchor);
         }
         if (textAnchors != null)
         {
             foreach (TextAnchor textAnchor in textAnchors)
             {
                 this.anchors.Remove(textAnchor);
             }
         }
     }
 }
Exemple #3
0
		/// <summary>
		/// Is called after a newline was inserted into this line, splitting it into this and followingLine.
		/// </summary>
		internal void SplitTo(LineSegment followingLine)
		{
			//Console.WriteLine("SplitTo");
			
			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);
					}
				}
			}
		}