C++ indenter: Don't use label indent when typing 'Type:'.

It could easily be followed by another colon.

Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2010-12-07 14:30:17 +01:00
parent 53c7871099
commit f64462ab1d

View File

@@ -73,9 +73,16 @@ void CppQtStyleIndenter::indentBlock(QTextDocument *doc,
int padding;
codeFormatter.indentFor(block, &indent, &padding);
// only reindent the current line when typing electric characters if the
// indent is the same it would be if the line were empty
if (isElectricCharacter(typedChar)) {
// : is only electric if the line has a 'case' or 'default'
if (typedChar == QLatin1Char(':')
&& !(block.text().contains(QLatin1String("case"))
|| block.text().contains(QLatin1String("default")))) {
return;
}
// only reindent the current line when typing electric characters if the
// indent is the same it would be if the line were empty
int newlineIndent;
int newlinePadding;
codeFormatter.indentForNewLineAfter(block.previous(), &newlineIndent, &newlinePadding);