Commit ca6f7352 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Fixed renaming when the cursor is at the end of the ID.

Task-number: QTCREATORBUG-909.
Reviewed-by: Thorbjørn
parent dab558d4
......@@ -907,9 +907,13 @@ void QmlJSTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
QString QmlJSTextEditor::wordUnderCursor() const
{
QTextCursor tc = textCursor();
const QChar ch = characterAt(tc.position() - 1);
// make sure that we're not at the start of the next word.
if (ch.isLetterOrNumber() || ch == QLatin1Char('_'))
tc.movePosition(QTextCursor::Left);
tc.movePosition(QTextCursor::StartOfWord);
tc.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
const QString word= tc.selectedText();
const QString word = tc.selectedText();
return word;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment