From b6d7fecf801449894d2e82719d94da5fc364963c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Tue, 21 Apr 2009 15:32:50 +0200
Subject: [PATCH] Fixed navigation with F2 when at the start of a word

Reviewed-by: con
---
 src/plugins/cppeditor/cppeditor.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 8ca868ad75d..3544cf3f2d3 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -604,6 +604,13 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
 
     QTextCursor tc = cursor;
 
+    // Make sure we're not at the start of a word
+    {
+        const QChar c = characterAt(tc.position());
+        if (c.isLetter() || c == QLatin1Char('_'))
+            tc.movePosition(QTextCursor::Right);
+    }
+
     static TokenUnderCursor tokenUnderCursor;
 
     QTextBlock block;
-- 
GitLab