C++ tooltip: Display macro tooltip only if hover is actually over the macro name.

This commit is contained in:
Leandro Melo
2010-07-13 12:46:43 +02:00
parent 72bb7c5c11
commit a4cd93889f

View File

@@ -256,12 +256,13 @@ bool CppHoverHandler::matchMacroInUse(const CPlusPlus::Document::Ptr &document,
{
foreach (const Document::MacroUse &use, document->macroUses()) {
if (use.contains(pos)) {
const Macro& macro = use.macro();
m_toolTip = macro.toString();
m_helpCandidates.append(HelpCandidate(macro.name(),
macro.name(),
HelpCandidate::Macro));
return true;
const int begin = use.begin();
const QString &name = use.macro().name();
if (pos < begin + name.length()) {
m_toolTip = use.macro().toString();
m_helpCandidates.append(HelpCandidate(name, name, HelpCandidate::Macro));
return true;
}
}
}
return false;