Commit 17fd4d88 authored by hjk's avatar hjk
Browse files

CppEditor: Fix off-by-one in string literal auto splitting



Task-number: QTCREATORBUG-13272
Change-Id: I343eb2b8b3a42c0090856f038254908611f25155
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 4e475fb5
......@@ -102,7 +102,7 @@ static bool isInStringHelper(const QTextCursor &cursor, Token *retToken = 0)
const unsigned pos = cursor.selectionEnd() - cursor.block().position();
if (tokens.isEmpty() || pos < tokens.first().utf16charsBegin())
if (tokens.isEmpty() || pos <= tokens.first().utf16charsBegin())
return false;
if (pos >= tokens.last().utf16charsEnd()) {
......@@ -113,7 +113,7 @@ static bool isInStringHelper(const QTextCursor &cursor, Token *retToken = 0)
Token tk = tokenAtPosition(tokens, pos);
if (retToken)
*retToken = tk;
return tk.isStringLiteral();
return tk.isStringLiteral() && pos > tk.utf16charsBegin();
}
bool CppAutoCompleter::contextAllowsAutoParentheses(const QTextCursor &cursor,
......
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