forked from qt-creator/qt-creator
Fixed renaming when the cursor is at the end of the ID.
Task-number: QTCREATORBUG-909. Reviewed-by: Thorbjørn
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user