public void AutoIndentSegment(Span span)
{
if (span == null)
span = this[0].startSpan;
Row start = span.StartRow;
Row end = span.EndRow;
if (start == null)
start = this[0];
if (end == null)
end = this[Count - 1];
for (int i = start.Index; i <= end.Index; i++)
{
Row r = this[i];
int depth = r.Indent;
string text = r.Text.Substring(r.GetLeadingWhitespace().Length);
var indent = new string('\t', depth);
r.Text = indent + text;
}
ResetVisibleRows();
}