From 04679f8071bbd0207c5a1ff0b7fc01e8ab97d2e7 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Thu, 15 Mar 2012 21:06:11 +0100 Subject: [PATCH] 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 Reviewed-by: Orgad Shaneh Reviewed-by: Leandro Melo --- src/plugins/cpptools/cppfindreferences.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index b6305a359ee..30e5690b7e7 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -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 ¯o) { // ### 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 result;