From 3decf8ccc01e95664fd0e128e9bcdddd90b15571 Mon Sep 17 00:00:00 2001
From: Roberto Raggi <roberto.raggi@nokia.com>
Date: Fri, 14 May 2010 15:33:01 +0200
Subject: [PATCH] Jump to the declaration if the last visible symbol is the
 current function definition.

---
 src/plugins/cppeditor/cppeditor.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 60b7b7b2b59..35390c65c0b 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1348,9 +1348,13 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
         if (Symbol *symbol = result.declaration()) {
             Symbol *def = 0;
 
-            if (resolveTarget)
+            if (resolveTarget) {
                 def = findDefinition(symbol, snapshot);
 
+                if (def == doc->findSymbolAt(line, column))
+                    def = 0; // jump to declaration then.
+            }
+
             link = linkToSymbol(def ? def : symbol);
             link.begin = beginOfToken;
             link.end = endOfToken;
-- 
GitLab