Indenters: Move style setup into the QtStyleCodeFormatter constructors.

This makes sure styles are consistent for the editor and the quick fix
engine.
This commit is contained in:
Christian Kamm
2010-08-12 14:00:15 +02:00
parent 0355e37e53
commit 538f611503
9 changed files with 50 additions and 38 deletions

View File

@@ -1276,21 +1276,13 @@ bool QmlJSTextEditor::isClosingBrace(const QList<Token> &tokens) const
return false;
}
static QmlJSEditor::QtStyleCodeFormatter setupCodeFormatter(const TextEditor::TabSettings &ts)
{
QmlJSEditor::QtStyleCodeFormatter codeFormatter;
codeFormatter.setIndentSize(ts.m_indentSize);
codeFormatter.setTabSize(ts.m_tabSize);
return codeFormatter;
}
void QmlJSTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
{
Q_UNUSED(doc)
Q_UNUSED(typedChar)
const TextEditor::TabSettings &ts = tabSettings();
QmlJSEditor::QtStyleCodeFormatter codeFormatter = setupCodeFormatter(ts);
QmlJSEditor::QtStyleCodeFormatter codeFormatter(ts);
codeFormatter.updateStateUntil(block);
const int depth = codeFormatter.indentFor(block);