Skip to content
Snippets Groups Projects
Commit 04679f80 authored by Andre Hartmann's avatar Andre Hartmann Committed by Leandro Melo
Browse files

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: default avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarLeandro Melo <leandro.melo@nokia.com>
parent 2176599e
No related branches found
No related tags found
No related merge requests found
...@@ -560,7 +560,7 @@ public: ...@@ -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) ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment