public void Remove(int index, int count)
        {
            if (index > CurrentText.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(index));
            }

            var transform = new TransformCharIterator.Transform(offsetInSource: index, count);

            // leave source open as we dispose CurrentText in SetText()
            using (var iter = IteratorPool.Rent(
                       CurrentText, leaveSourceOpen: true, transform, leaveTransformOpen: false))
            {
                SetText(_font, iter, _usedColorFormat);
            }
        }
Exemple #2
0
        public void Insert(int index, ICharIterator chars, int offset, int count, bool useColorFormat)
        {
            if (index > CurrentText.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(index));
            }

            var transform = new TransformCharIterator.Transform(offsetInSource: index, chars, offset, count);

            // leave source open as we dispose CurrentText in SetText()
            using (var iter = IteratorPool.Rent(
                       CurrentText, leaveSourceOpen: true, transform, leaveTransformOpen: true))
            {
                SetText(_font, iter, useColorFormat);
            }

            BuildSprites(measure: false);
        }