diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 40294cde5ea5ebc42cdd8af1fe3822c796d8fefc..ec1aafc753a0b273bf068f5b7952524c238809f0 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1494,13 +1494,21 @@ bool CPPEditor::isInComment(const QTextCursor &cursor) const
 void CPPEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
 {
     Q_UNUSED(doc)
-    Q_UNUSED(typedChar)
 
     const TabSettings &ts = tabSettings();
     CppTools::QtStyleCodeFormatter codeFormatter(ts);
 
     codeFormatter.updateStateUntil(block);
     const int depth = codeFormatter.indentFor(block);
+
+    // 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)) {
+        const int newlineIndent = codeFormatter.indentForNewLineAfter(block.previous());
+        if (ts.indentationColumn(block.text()) != newlineIndent)
+            return;
+    }
+
     ts.indentLine(block, depth);
 }
 
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index a16248808895668691050ea7a09b7049539fa26e..89c9d85f5ea6881048c93f65c97271be8fd2bb06 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -470,6 +470,12 @@ int CodeFormatter::indentFor(const QTextBlock &block)
     return m_indentDepth;
 }
 
+int CodeFormatter::indentForNewLineAfter(const QTextBlock &block)
+{
+    restoreCurrentState(block);
+    return m_indentDepth;
+}
+
 void CodeFormatter::updateStateUntil(const QTextBlock &endBlock)
 {
     QStack<State> previousState = initialState();
diff --git a/src/plugins/cpptools/cppcodeformatter.h b/src/plugins/cpptools/cppcodeformatter.h
index a9a9aa7e06beeca66f6b5c3db6f9a17d86978b6b..e0365cb5cf24f39cdbd2b09ea5e06c42ed55efd3 100644
--- a/src/plugins/cpptools/cppcodeformatter.h
+++ b/src/plugins/cpptools/cppcodeformatter.h
@@ -69,6 +69,7 @@ public:
     void updateLineStateChange(const QTextBlock &block);
 
     int indentFor(const QTextBlock &block);
+    int indentForNewLineAfter(const QTextBlock &block);
 
     void setTabSize(int tabSize);