Alsing.Windows.Forms.SyntaxBoxControl.ConvertTabsToSpaces C# (CSharp) Method

ConvertTabsToSpaces() public method

Converts all tabs to spaces the size of .TabSize in the Document.
public ConvertTabsToSpaces ( ) : void
return void
        public void ConvertTabsToSpaces()
        {
            if (_Document != null)
            {
                _Document.StartUndoCapture();
                var spaces = new string(' ', _TabSize);
                // Iterate all rows and convert tabs to spaces.
                for (int count = 0; count < _Document.Count; count++)
                {
                    Row row = _Document[count];

                    string rowText = row.Text;
                    string newText = rowText.Replace("\t", spaces);
                    // If this has made a change to the row, update it.
                    if (newText != rowText)
                    {
                        _Document.DeleteRange(new TextRange(0, count, rowText.Length, count));
                        _Document.InsertText(newText, 0, count, true);
                    }
                }
                _Document.EndUndoCapture();
            }
        }