forked from qt-creator/qt-creator
Editor: Collect indentation for a list of text blocks
Allows the indenter to reuse code formatter structures. Task-number: QTCREATORBUG-16420 Change-Id: Ie906d7fdcb50798da02ef5b750fb03ae752aadc1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -90,3 +90,19 @@ int Indenter::indentFor(const QTextBlock &block,
|
||||
codeFormatter.updateStateUntil(block);
|
||||
return codeFormatter.indentFor(block);
|
||||
}
|
||||
|
||||
|
||||
TextEditor::IndentationForBlock
|
||||
Indenter::indentationForBlocks(const QVector<QTextBlock> &blocks,
|
||||
const TextEditor::TabSettings &tabSettings)
|
||||
{
|
||||
QmlJSTools::CreatorCodeFormatter codeFormatter(tabSettings);
|
||||
|
||||
|
||||
codeFormatter.updateStateUntil(blocks.last());
|
||||
|
||||
TextEditor::IndentationForBlock ret;
|
||||
foreach (QTextBlock block, blocks)
|
||||
ret.insert(block.blockNumber(), codeFormatter.indentFor(block));
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user