Commit 04679f80 authored by Andre Hartmann's avatar Andre Hartmann Committed by Leandro Melo

Improved highlighting in C++ Macro Usages.

Only highlight the Macro name, not the whole definition line
or the parameter list in function-like Macros.

Change-Id: I5732dd5dd18cee150755ea35a5fbb67fdaed51c4
Reviewed-by: default avatarFrancois Ferrand <thetypz@gmail.com>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarLeandro Melo <leandro.melo@nokia.com>
parent 2176599e
......@@ -560,7 +560,7 @@ public:
unsigned lineStart;
const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
usages.append(Usage(fileName, lineSource, use.beginLine(),
use.begin() - lineStart, use.length()));
use.begin() - lineStart, useMacro.name().length()));
}
}
......@@ -644,8 +644,9 @@ void CppFindReferences::findMacroUses(const Macro &macro)
{
// ### FIXME: Encoding?
const QByteArray &source = getSource(macro.fileName(), workingCopy).toLatin1();
search->addResult(macro.fileName(), macro.line(),
source.mid(macro.offset(), macro.length()), 0, macro.length());
const QByteArray line = source.mid(macro.offset(), macro.length());
search->addResult(macro.fileName(), macro.line(), line,
line.indexOf(macro.name()), macro.name().length());
}
QFuture<Usage> result;
......
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