Commit 96545632 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Make links to functions much more responsive

By avoiding searching for the definition when it isn't necessary.
parent f36ea678
......@@ -587,7 +587,8 @@ void CPPEditor::switchDeclarationDefinition()
}
}
CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor)
CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
bool lookupDefinition)
{
Link link;
......@@ -648,7 +649,7 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor)
Symbol *symbol = resolvedSymbols.first().second;
if (symbol) {
Symbol *def = 0;
if (!lastSymbol->isFunction())
if (lookupDefinition && !lastSymbol->isFunction())
def = findDefinition(symbol);
link = linkToSymbol(def ? def : symbol);
......@@ -822,7 +823,7 @@ void CPPEditor::mouseMoveEvent(QMouseEvent *e)
onText = cursorRect(nextPos).right() >= e->x();
}
const Link link = findLinkAt(cursor);
const Link link = findLinkAt(cursor, false);
if (onText && !link.fileName.isEmpty()) {
QTextEdit::ExtraSelection sel;
......
......@@ -148,7 +148,7 @@ private:
int column; // Target column
};
Link findLinkAt(const QTextCursor &);
Link findLinkAt(const QTextCursor &, bool lookupDefinition = true);
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
bool openCppEditorAt(const Link &);
QTextCharFormat m_linkFormat;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment