Skip to content
Snippets Groups Projects
Commit f64462ab authored by Christian Kamm's avatar Christian Kamm
Browse files

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

It could easily be followed by another colon.

Reviewed-by: Roberto Raggi
parent 53c78710
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment