summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppfindreferences.cpp
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2012-03-15 21:06:11 +0100
committerLeandro Melo <leandro.melo@nokia.com>2012-03-16 15:11:07 +0100
commit04679f8071bbd0207c5a1ff0b7fc01e8ab97d2e7 (patch)
tree1672e37ba1d71b39fea6e6eb1bd54d990f8a1f81 /src/plugins/cpptools/cppfindreferences.cpp
parent2176599e745c2d31bb0f7656ea0068e4d6113fa8 (diff)
downloadqt-creator-04679f8071bbd0207c5a1ff0b7fc01e8ab97d2e7.tar.gz
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>
Diffstat (limited to 'src/plugins/cpptools/cppfindreferences.cpp')
-rw-r--r--src/plugins/cpptools/cppfindreferences.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp
index b6305a359e..30e5690b7e 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 &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;