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: Francois Ferrand <thetypz@gmail.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Andre Hartmann
2012-03-15 21:06:11 +01:00
committed by Leandro Melo
parent 2176599e74
commit 04679f8071

View File

@@ -560,7 +560,7 @@ public:
unsigned lineStart; unsigned lineStart;
const QString &lineSource = matchingLine(use.begin(), source, &lineStart); const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
usages.append(Usage(fileName, lineSource, use.beginLine(), 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? // ### FIXME: Encoding?
const QByteArray &source = getSource(macro.fileName(), workingCopy).toLatin1(); const QByteArray &source = getSource(macro.fileName(), workingCopy).toLatin1();
search->addResult(macro.fileName(), macro.line(), const QByteArray line = source.mid(macro.offset(), macro.length());
source.mid(macro.offset(), macro.length()), 0, macro.length()); search->addResult(macro.fileName(), macro.line(), line,
line.indexOf(macro.name()), macro.name().length());
} }
QFuture<Usage> result; QFuture<Usage> result;