forked from qt-creator/qt-creator
Cpp{Tools,Editor}: Respect multi-QChar code points when handling identifiers
* Consolidate code dealing with C++ identifiers into cpptoolsreuse.h * Handle code points that are represented with two QChars Change-Id: I4fb4435aa539f65d88598cac0b50629f33f32440 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -176,11 +176,6 @@ struct CanonicalSymbol
|
||||
return typeOfExpression.context();
|
||||
}
|
||||
|
||||
static inline bool isIdentifierChar(const QChar &ch)
|
||||
{
|
||||
return ch.isLetterOrNumber() || ch == QLatin1Char('_');
|
||||
}
|
||||
|
||||
Scope *getScopeAndExpression(const QTextCursor &cursor, QString *code)
|
||||
{
|
||||
return getScopeAndExpression(editor, info, cursor, code);
|
||||
@@ -202,11 +197,11 @@ struct CanonicalSymbol
|
||||
|
||||
int pos = tc.position();
|
||||
|
||||
if (!isIdentifierChar(document->characterAt(pos)))
|
||||
if (!(pos > 0 && isIdentifierChar(document->characterAt(pos - 1))))
|
||||
if (!isValidIdentifierChar(document->characterAt(pos)))
|
||||
if (!(pos > 0 && isValidIdentifierChar(document->characterAt(pos - 1))))
|
||||
return 0;
|
||||
|
||||
while (isIdentifierChar(document->characterAt(pos)))
|
||||
while (isValidIdentifierChar(document->characterAt(pos)))
|
||||
++pos;
|
||||
tc.setPosition(pos);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user