forked from qt-creator/qt-creator
C++: Add utf16 indices to Macro and Document::MacroUse
In most cases we need to work with the utf16 indices. Only in cppfindreferences the byte interface is still needed since there we read in files and work on a QByteArray to save memory. Change-Id: I6ef6a93fc1875a8c9a305c075d51a9ca034c41bb Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -59,15 +59,15 @@ QFuture<TextEditor::HighlightingResult> CppHighlightingSupportInternal::highligh
|
||||
// Get macro definitions
|
||||
foreach (const CPlusPlus::Macro& macro, doc->definedMacros()) {
|
||||
int line, column;
|
||||
editor()->convertPosition(macro.offset(), &line, &column);
|
||||
editor()->convertPosition(macro.utf16CharOffset(), &line, &column);
|
||||
++column; //Highlighting starts at (column-1) --> compensate here
|
||||
Result use(line, column, macro.name().size(), MacroUse);
|
||||
Result use(line, column, macro.nameToQString().size(), MacroUse);
|
||||
macroUses.append(use);
|
||||
}
|
||||
|
||||
// Get macro uses
|
||||
foreach (const Document::MacroUse ¯o, doc->macroUses()) {
|
||||
const QString name = QString::fromUtf8(macro.macro().name());
|
||||
const QString name = macro.macro().nameToQString();
|
||||
|
||||
//Filter out QtKeywords
|
||||
if (isQtKeyword(QStringRef(&name)))
|
||||
@@ -86,7 +86,7 @@ QFuture<TextEditor::HighlightingResult> CppHighlightingSupportInternal::highligh
|
||||
continue;
|
||||
|
||||
int line, column;
|
||||
editor()->convertPosition(macro.begin(), &line, &column);
|
||||
editor()->convertPosition(macro.utf16charsBegin(), &line, &column);
|
||||
++column; //Highlighting starts at (column-1) --> compensate here
|
||||
Result use(line, column, name.size(), MacroUse);
|
||||
macroUses.append(use);
|
||||
|
||||
Reference in New Issue
Block a user