summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2009-10-08 14:26:54 +0200
committercon <qtc-committer@nokia.com>2009-10-08 18:54:42 +0200
commit6f85b24ab73e41b1fd5687943d01e1f8d75624ed (patch)
treed5baa0c51ebccb19d79da7bd3b4835dece91fb18
parentf5f6ad48643ed98f9130138ab0b1b8c6f27695d9 (diff)
downloadqt-creator-6f85b24ab73e41b1fd5687943d01e1f8d75624ed.tar.gz
Fixed refactoring when the cursor is at the end of a symbol.
Reviewed by: Roberto Raggi (cherry picked from commit 5852cc805d68f21ed0ac34191bb1e3f3002e9b4d)
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index eeda79c9e1..68885add66 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);