예제 #1
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other, bool inclusiveEnd)
 {
     if (inclusiveEnd)
     {
         return(ContainsInclusiveEnd(range, other));
     }
     return(range.Contains(other.Start) && range.Contains(other.End));
 }
예제 #2
0
        public override IReadOnlyList <T> ItemsInRange(ITextRange range)
        {
            IReadOnlyList <T> list = base.ItemsInRange(range);

            if (Count > 0)
            {
                IHtmlToken lastItem = this[Count - 1] as IHtmlToken;
                if (lastItem != null && !lastItem.IsWellFormed)
                {
                    if (range.Contains(lastItem.End))
                    {
                        // Underlying method returs static readonly collection if nothing was found
                        // in the range so we need to create a new collection here.
                        List <T> modifiedList = new List <T>(list.Count + 1);
                        modifiedList.AddRange(list);
                        modifiedList.Add(this[Count - 1]);

                        list = modifiedList;
                    }
                }
            }

            return(list);
        }
예제 #3
0
파일: TextRange.cs 프로젝트: nomada2/RTVS
 /// <summary>
 /// Determines if range contains another range or it contains start point
 /// of the other range and their end points are the same.
 /// </summary>
 public static bool ContainsInclusiveEnd(ITextRange range, ITextRange other)
 {
     return(range.Contains(other.Start) && (range.Contains(other.End) || range.End == other.End));
 }
예제 #4
0
파일: TextRange.cs 프로젝트: nomada2/RTVS
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other)
 {
     return(range.Contains(other.Start) && range.Contains(other.End));
 }
예제 #5
0
 public bool Contains(int position)
 {
     return(_range.Contains(position));
 }
예제 #6
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other) => range.Contains(other.Start) && range.Contains(other.End);
예제 #7
0
파일: TextRange.cs 프로젝트: Microsoft/RTVS
 /// <summary>
 /// Determines if range contains another range or it contains start point
 /// of the other range and their end points are the same.
 /// </summary>
 public static bool ContainsInclusiveEnd(ITextRange range, ITextRange other) {
     return range.Contains(other.Start) && (range.Contains(other.End) || range.End == other.End);
 }
예제 #8
0
파일: TextRange.cs 프로젝트: Microsoft/RTVS
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other, bool inclusiveEnd) {
     if (inclusiveEnd)
         return ContainsInclusiveEnd(range, other);
     else
         return range.Contains(other.Start) && range.Contains(other.End);
 }
예제 #9
0
파일: TextRange.cs 프로젝트: Microsoft/RTVS
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other) {
     return range.Contains(other.Start) && range.Contains(other.End);
 }