diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 5046a8c9a21..b0caaeb35b0 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1862,5 +1862,3 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source) return semanticInfo; } - - diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 4c7c0a038f5..63a4d4c6cc1 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -1510,11 +1511,14 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) if (endWithSemicolon) extraChars += QLatin1Char(';'); } else if (autoParenthesesEnabled) { - extraChars += QLatin1Char(')'); - --cursorOffset; - if (endWithSemicolon) { - extraChars += QLatin1Char(';'); + const QChar lookAhead = m_editor->characterAt(m_editor->position() + 1); + if (MatchingText::shouldInsertMatchingText(lookAhead)) { + extraChars += QLatin1Char(')'); --cursorOffset; + if (endWithSemicolon) { + extraChars += QLatin1Char(';'); + --cursorOffset; + } } } }