From 5852cc805d68f21ed0ac34191bb1e3f3002e9b4d Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 8 Oct 2009 14:26:54 +0200 Subject: [PATCH] Fixed refactoring when the cursor is at the end of a symbol. Reviewed by: Roberto Raggi --- src/plugins/cppeditor/cppeditor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index eeda79c9e1a..68885add66f 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -831,9 +831,13 @@ CPlusPlus::Symbol *CPPEditor::findCanonicalSymbol(const QTextCursor &cursor, QTextCursor tc = cursor; int line, col; convertPosition(tc.position(), &line, &col); - ++col; + ++col; // 1-based line and 1-based column - tc.movePosition(QTextCursor::EndOfWord); + int pos = tc.position(); + while (document()->characterAt(pos).isLetterOrNumber() || + document()->characterAt(pos) == QLatin1Char('_')) + ++pos; + tc.setPosition(pos); ExpressionUnderCursor expressionUnderCursor; const QString code = expressionUnderCursor(tc);