From de6166fc91d57f20efa54602dda4380f0c2e18c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com> Date: Tue, 24 Mar 2009 14:52:20 +0100 Subject: [PATCH] Don't try to resolve plain literals or comments There's no place to jump to in these cases. --- src/plugins/cppeditor/cppeditor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index dfcd3ac2fe0..9e884448bf5 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -47,6 +47,7 @@ #include <cplusplus/Overview.h> #include <cplusplus/OverviewModel.h> #include <cplusplus/SimpleLexer.h> +#include <cplusplus/TokenUnderCursor.h> #include <cplusplus/TypeOfExpression.h> #include <cpptools/cppmodelmanagerinterface.h> @@ -627,13 +628,15 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor) tc.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); const int nameStart = tc.position(); const int nameLength = tc.anchor() - tc.position(); + tc.setPosition(endOfName); - // Drop out if we're at a number - if (characterAt(nameStart).isNumber()) + // Drop out if we're at a number, string or comment + static TokenUnderCursor tokenUnderCursor; + const SimpleToken tk = tokenUnderCursor(tc); + if (tk.isLiteral() || tk.isComment()) return link; // Evaluate the type of the expression under the cursor - tc.setPosition(endOfName); ExpressionUnderCursor expressionUnderCursor; const QString expression = expressionUnderCursor(tc); TypeOfExpression typeOfExpression; -- GitLab