Merge commit 'origin/1.3'

Conflicts:
	src/plugins/cppeditor/cppeditor.cpp
This commit is contained in:
mae
2009-12-03 18:41:21 +01:00
4 changed files with 16 additions and 9 deletions

View File

@@ -673,26 +673,30 @@ void CPPEditor::inAllRenameSelections(EditOperation operation,
{
cursor.beginEditBlock();
const int offset = cursor.position() - currentRenameSelection.cursor.anchor();
const int startOffset = cursor.selectionStart() - currentRenameSelection.cursor.anchor();
const int endOffset = cursor.selectionEnd() - currentRenameSelection.cursor.anchor();
const int length = endOffset - startOffset;
for (int i = 0; i < m_renameSelections.size(); ++i) {
QTextEdit::ExtraSelection &s = m_renameSelections[i];
int pos = s.cursor.anchor();
int endPos = s.cursor.position();
s.cursor.setPosition(s.cursor.anchor() + offset);
s.cursor.setPosition(pos + startOffset);
s.cursor.setPosition(pos + endOffset, QTextCursor::KeepAnchor);
switch (operation) {
case DeletePreviousChar:
s.cursor.deletePreviousChar();
--endPos;
endPos -= qMax(1, length);
break;
case DeleteChar:
s.cursor.deleteChar();
--endPos;
endPos -= qMax(1, length);
break;
case InsertText:
s.cursor.insertText(text);
endPos += text.length();
endPos += text.length() - length;
break;
}