forked from qt-creator/qt-creator
CppEditor: Fix renaming location for "optimize for loop" quickfix
Use the start of the variable name, not the end. It's more natural, and it prevents problems with the clang code model, as isCursorOnIdentifier() returns false if the cursor is after the last character of the name. Change-Id: I368ccf5cef9c3fb04c0902e49f8a189c102c481f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -7245,7 +7245,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
renamePos = file->endOf(m_forAst->initializer) + 1 + varName.length();
|
||||
renamePos = file->endOf(m_forAst->initializer) + 1;
|
||||
change.insert(file->endOf(m_forAst->initializer) - 1, // "-1" because of ";"
|
||||
QLatin1String(", ") + varName + QLatin1String(" = ")
|
||||
+ file->textOf(m_expression));
|
||||
|
Reference in New Issue
Block a user