Exemplo n.º 1
0
        /// <summary>
        /// Returns the position of the next highlight start or end in an
        /// indicated direction, or null if there is no such position.
        /// </summary>
        /// <param name="textPosition">
        /// Position to query.
        /// </param>
        /// <param name="direction">
        /// Direction of content to query.
        /// </param>
        internal virtual StaticTextPointer GetNextHighlightChangePosition(StaticTextPointer textPosition, LogicalDirection direction)
        {
            StaticTextPointer changePosition;
            StaticTextPointer closestChangePosition;
            int i;

            closestChangePosition = StaticTextPointer.Null;

            // Calculate the min of the layers' transitions.
            for (i = 0; i < this.LayerCount; i++)
            {
                changePosition = GetLayer(i).GetNextChangePosition(textPosition, direction);

                if (!changePosition.IsNull)
                {
                    if (closestChangePosition.IsNull)
                    {
                        closestChangePosition = changePosition;
                    }
                    else if (direction == LogicalDirection.Forward)
                    {
                        closestChangePosition = StaticTextPointer.Min(closestChangePosition, changePosition);
                    }
                    else
                    {
                        closestChangePosition = StaticTextPointer.Max(closestChangePosition, changePosition);
                    }
                }
            }

            return(closestChangePosition);
        }
        // Token: 0x06003006 RID: 12294 RVA: 0x000D8010 File Offset: 0x000D6210
        internal virtual StaticTextPointer GetNextHighlightChangePosition(StaticTextPointer textPosition, LogicalDirection direction)
        {
            StaticTextPointer staticTextPointer = StaticTextPointer.Null;

            for (int i = 0; i < this.LayerCount; i++)
            {
                StaticTextPointer nextChangePosition = this.GetLayer(i).GetNextChangePosition(textPosition, direction);
                if (!nextChangePosition.IsNull)
                {
                    if (staticTextPointer.IsNull)
                    {
                        staticTextPointer = nextChangePosition;
                    }
                    else if (direction == LogicalDirection.Forward)
                    {
                        staticTextPointer = StaticTextPointer.Min(staticTextPointer, nextChangePosition);
                    }
                    else
                    {
                        staticTextPointer = StaticTextPointer.Max(staticTextPointer, nextChangePosition);
                    }
                }
            }
            return(staticTextPointer);
        }