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:
@@ -591,7 +591,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
const Macro *macro = doc->findMacroDefinitionAt(line);
|
||||
if (macro) {
|
||||
QTextCursor macroCursor = cursor;
|
||||
const QByteArray name = CPPEditorWidget::identifierUnderCursor(¯oCursor).toLatin1();
|
||||
const QByteArray name = CPPEditorWidget::identifierUnderCursor(¯oCursor).toUtf8();
|
||||
if (macro->name() == name)
|
||||
return link; //already on definition!
|
||||
} else if (const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1)) {
|
||||
@@ -602,8 +602,8 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
const Macro ¯o = use->macro();
|
||||
link.targetFileName = macro.fileName();
|
||||
link.targetLine = macro.line();
|
||||
link.linkTextStart = use->begin();
|
||||
link.linkTextEnd = use->end();
|
||||
link.linkTextStart = use->utf16charsBegin();
|
||||
link.linkTextEnd = use->utf16charsEnd();
|
||||
}
|
||||
return link;
|
||||
}
|
||||
@@ -722,7 +722,7 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
|
||||
|
||||
// Handle macro uses
|
||||
QTextCursor macroCursor = cursor;
|
||||
const QByteArray name = CPPEditorWidget::identifierUnderCursor(¯oCursor).toLatin1();
|
||||
const QByteArray name = CPPEditorWidget::identifierUnderCursor(¯oCursor).toUtf8();
|
||||
link = findMacroLink(name, documentFromSemanticInfo);
|
||||
if (link.hasValidTarget()) {
|
||||
link.linkTextStart = macroCursor.selectionStart();
|
||||
|
||||
Reference in New Issue
Block a user