From 8dbbf9be92f834b021183ac0ad7c851b86e288ce Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Tue, 6 Jul 2010 13:52:49 +0200 Subject: C++ indenter: Require explicit state update requests. This will allow much faster indenting of selected areas as the state doesn't have to be checked again for every line. --- src/plugins/cpptools/cppcodeformatter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/plugins/cpptools/cppcodeformatter.cpp') diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 97db194e70..0eb40bf4e9 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -446,12 +446,12 @@ int CodeFormatter::indentFor(const QTextBlock &block) { // qDebug() << "indenting for" << block.blockNumber() + 1; - requireStatesUntil(block); + restoreBlockState(block.previous()); correctIndentation(block); return m_indentDepth; } -void CodeFormatter::requireStatesUntil(const QTextBlock &endBlock) +void CodeFormatter::updateStateUntil(const QTextBlock &endBlock) { QStack previousState = initialState(); QTextBlock it = endBlock.document()->firstBlock(); @@ -473,7 +473,6 @@ void CodeFormatter::requireStatesUntil(const QTextBlock &endBlock) //qDebug() << "recalc line" << it.blockNumber() + 1; recalculateStateAfter(it); } - restoreBlockState(endBlock.previous()); } CodeFormatter::State CodeFormatter::state(int belowTop) const -- cgit v1.2.1