Example #1
0
        private void EnsureSelectionArrays(int textColumnIndex)
        {
            if (textColumnIndex < this._selectionStart.Length)
            {
                // There exists a text column for the given column index,
                // so there's nothing to do here except happily return.
                return;
            }

            // Add a new column index if needed.
            var currentSelectionStarts  = new List <int>(this._selectionStart);
            var currentSelectionLengths = new List <int>(this._selectionStart);
            var currentSelectionStyles  = new List <ITextSegmentStyled>(this._textSegmentSelection);

            for (var i = this._selectionStart.Length; i <= textColumnIndex; i++)
            {
                currentSelectionStarts.Add(0);
                currentSelectionLengths.Add(0);

                currentSelectionStyles.Add(TextDocument.CreateStyledTextSegment(this.GetTextStyle("Selection")));
            }

            this._selectionStart       = currentSelectionStarts.ToArray();
            this._selectionLength      = currentSelectionLengths.ToArray();
            this._textSegmentSelection = currentSelectionStyles.ToArray();
        }