Commit bf74d21d authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Avoid completing a closing parenthesis in the wrong place

Need to check the character to the right of the cursor.
parent 7a920e46
...@@ -1862,5 +1862,3 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source) ...@@ -1862,5 +1862,3 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
return semanticInfo; return semanticInfo;
} }
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <cplusplus/ResolveExpression.h> #include <cplusplus/ResolveExpression.h>
#include <cplusplus/LookupContext.h> #include <cplusplus/LookupContext.h>
#include <cplusplus/MatchingText.h>
#include <cplusplus/Overview.h> #include <cplusplus/Overview.h>
#include <cplusplus/ExpressionUnderCursor.h> #include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/TokenUnderCursor.h> #include <cplusplus/TokenUnderCursor.h>
...@@ -1510,11 +1511,14 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) ...@@ -1510,11 +1511,14 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
if (endWithSemicolon) if (endWithSemicolon)
extraChars += QLatin1Char(';'); extraChars += QLatin1Char(';');
} else if (autoParenthesesEnabled) { } else if (autoParenthesesEnabled) {
extraChars += QLatin1Char(')'); const QChar lookAhead = m_editor->characterAt(m_editor->position() + 1);
--cursorOffset; if (MatchingText::shouldInsertMatchingText(lookAhead)) {
if (endWithSemicolon) { extraChars += QLatin1Char(')');
extraChars += QLatin1Char(';');
--cursorOffset; --cursorOffset;
if (endWithSemicolon) {
extraChars += QLatin1Char(';');
--cursorOffset;
}
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment