ClangFormat: Improve mass indentation performance

Do not indent lines separately but call reformat only
once and then extract the proper replacements.

Remove some redundant code in process.

Change-Id: If3a0419fef9fb2ec5422d11343fdc3414f5751b7
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-02-18 15:56:50 +01:00
parent 7f461b2e22
commit dcf763c7ee
2 changed files with 61 additions and 98 deletions

View File

@@ -75,16 +75,16 @@ protected:
private:
void indent(const QTextCursor &cursor, const QChar &typedChar, int cursorPositionInEditor);
void indentBlock(const QTextBlock &block, const QChar &typedChar, int cursorPositionInEditor);
void indentBlocks(const QTextBlock &startBlock,
const QTextBlock &endBlock,
const QChar &typedChar,
int cursorPositionInEditor);
int indentFor(const QTextBlock &block, int cursorPositionInEditor);
void indentBeforeCursor(const QTextBlock &block,
const QChar &typedChar,
int cursorPositionInEditor);
TextEditor::Replacements replacements(QByteArray buffer,
int utf8Offset,
int utf8Length,
const QTextBlock &block,
int cursorPositionInEditor,
const QTextBlock &startBlock,
const QTextBlock &endBlock,
ReplacementsToKeep replacementsToKeep,
const QChar &typedChar = QChar::Null,
bool secondTry = false) const;