diff options
author | David Schulz <[email protected]> | 2017-02-21 15:00:26 +0100 |
---|---|---|
committer | David Schulz <[email protected]> | 2017-02-22 13:08:15 +0000 |
commit | fc43fb477b44cc11842bf45af14d46385aa55442 (patch) | |
tree | d83e9062e9399b50f7a345d61b618198b05a1721 /src/libs/cplusplus | |
parent | 5103d4e53b4fbd64d08de9eff7c80201a68d81df (diff) |
C++: Do not add double quotes when splitting raw string litterals
Task-number: QTCREATORBUG-17717
Change-Id: Iffb34a3d77ada624dc13b8ab050ac08731d25863
Reviewed-by: Nikolai Kosjar <[email protected]>
Diffstat (limited to 'src/libs/cplusplus')
-rw-r--r-- | src/libs/cplusplus/MatchingText.cpp | 8 | ||||
-rw-r--r-- | src/libs/cplusplus/MatchingText.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/libs/cplusplus/MatchingText.cpp b/src/libs/cplusplus/MatchingText.cpp index 6a426ee4684..73a3df4b5bc 100644 --- a/src/libs/cplusplus/MatchingText.cpp +++ b/src/libs/cplusplus/MatchingText.cpp @@ -237,7 +237,7 @@ bool MatchingText::isInCommentHelper(const QTextCursor &cursor, Token *retToken) return tk.isComment(); } -bool MatchingText::isInStringHelper(const QTextCursor &cursor) +Kind MatchingText::stringKindAtCursor(const QTextCursor &cursor) { int prevState = 0; const Tokens tokens = getTokens(cursor, prevState); @@ -245,15 +245,15 @@ bool MatchingText::isInStringHelper(const QTextCursor &cursor) const unsigned pos = cursor.selectionEnd() - cursor.block().position(); if (tokens.isEmpty() || pos <= tokens.first().utf16charsBegin()) - return false; + return T_EOF_SYMBOL; if (pos >= tokens.last().utf16charsEnd()) { const Token tk = tokens.last(); - return tk.isStringLiteral() && prevState > 0; + return tk.isStringLiteral() && prevState > 0 ? tk.kind() : T_EOF_SYMBOL; } Token tk = tokenAtPosition(tokens, pos); - return tk.isStringLiteral() && pos > tk.utf16charsBegin(); + return tk.isStringLiteral() && pos > tk.utf16charsBegin() ? tk.kind() : T_EOF_SYMBOL; } QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess, diff --git a/src/libs/cplusplus/MatchingText.h b/src/libs/cplusplus/MatchingText.h index 0f861d152d0..59463917c41 100644 --- a/src/libs/cplusplus/MatchingText.h +++ b/src/libs/cplusplus/MatchingText.h @@ -26,6 +26,8 @@ #pragma once #include <QtGlobal> + +#include <cplusplus/Token.h> #include <cplusplus/CPlusPlusForwardDeclarations.h> QT_FORWARD_DECLARE_CLASS(QTextCursor) @@ -46,7 +48,7 @@ public: static bool shouldInsertMatchingText(QChar lookAhead); static bool isInCommentHelper(const QTextCursor &currsor, Token *retToken = 0); - static bool isInStringHelper(const QTextCursor &cursor); + static CPlusPlus::Kind stringKindAtCursor(const QTextCursor &cursor); static QString insertMatchingBrace(const QTextCursor &tc, const QString &text, QChar lookAhead, bool skipChars, int *skippedChars); |