public virtual void IndentLine(ITextEditor editor, IDocumentLine line)
        {
            IDocument document   = editor.Document;
            int       lineNumber = line.LineNumber;

            if (lineNumber > 1)
            {
                IDocumentLine previousLine = document.GetLineByNumber(lineNumber - 1);
                string        indentation  = DocumentUtilities.GetWhitespaceAfter(document, previousLine.Offset);
                // copy indentation to line
                string newIndentation = DocumentUtilities.GetWhitespaceAfter(document, line.Offset);
                document.Replace(line.Offset, newIndentation.Length, indentation);
            }
        }
Example #2
0
 public static string GetIndentation(IDocument document, int line)
 {
     return(DocumentUtilities.GetWhitespaceAfter(document, document.GetLineByNumber(line).Offset));
 }