public virtual void Clear() {
            OldRange = TextRange.EmptyRange;
            NewRange = TextRange.EmptyRange;

            OldText = null;
            NewText = null;
        }
        public CharacterStream(ITextProvider textProvider, ITextRange range) {
            _text = textProvider;

            int end = Math.Min(_text.Length, range.End);

            _range = TextRange.FromBounds(range.Start, end);

            Position = _range.Start;
            _currentChar = _text[_range.Start];
        }
Exemplo n.º 3
0
 /// <summary>
 /// Determines if range contains all ranges in a collection
 /// </summary>
 public static bool Contains(ITextRange range, IEnumerable<ITextRange> ranges) {
     var textRange = new TextRange(range);
     return textRange.Contains(ranges);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Determines if range contains another range
 /// </summary>
 public static bool Contains(ITextRange range, ITextRange other) {
     var textRange = new TextRange(range);
     return textRange.Contains(other);
 }
        public void Combine(TextChange other) {
            if (other.IsEmpty())
                return;

            if (OldRange == TextRange.EmptyRange || NewRange == TextRange.EmptyRange) {
                OldRange = other.OldRange;
                NewRange = other.NewRange;
            } else {
                int oldStart = Math.Min(other.OldRange.Start, this.OldRange.Start);
                int oldEnd = Math.Max(other.OldRange.End, this.OldRange.End);

                int newStart = Math.Min(other.NewRange.Start, this.NewRange.Start);
                int newEnd = Math.Max(other.NewRange.End, this.NewRange.End);

                this.OldRange = new TextRange(oldStart, oldEnd);
                this.NewRange = new TextRange(newStart, newEnd);
            }

            Version = Math.Max(this.Version, other.Version);
        }
 public TextChange(int start, int oldLength, int newLength) :
     this() {
     OldRange = new TextRange(start, start + oldLength);
     NewRange = new TextRange(start, start + newLength);
 }
 public IList <T> ItemsInRange(int start)
 {
     return(_collection.ItemsInRange(TextRange.FromBounds(start, start)));
 }
Exemplo n.º 8
0
 public CharacterStream(ITextProvider textProvider)
     : this(textProvider, TextRange.FromBounds(0, textProvider.Length))
 {
 }