Fixed Delete and Backspace in specific cases when renaming in-place

The Delete and Backspace keys are blocked when the cursor is
respectively at the end or beginning of a word that is being renamed
in-place. However, when there is a selection, the removal of this
selection is still supposed to be allowed.

Reviewed-by: Robert Loehning
This commit is contained in:
Thorbjørn Lindeijer
2010-03-25 16:44:41 +01:00
parent 8620678270
commit aa5899ad40

View File

@@ -1795,16 +1795,18 @@ void CPPEditor::keyPressEvent(QKeyEvent *e)
break; break;
} }
case Qt::Key_Backspace: { case Qt::Key_Backspace: {
if (cursor.position() == m_currentRenameSelectionBegin.position()) { if (cursor.position() == m_currentRenameSelectionBegin.position()
// Eat backspace at start of name && !cursor.hasSelection()) {
// Eat backspace at start of name when there is no selection
e->accept(); e->accept();
return; return;
} }
break; break;
} }
case Qt::Key_Delete: { case Qt::Key_Delete: {
if (cursor.position() == m_currentRenameSelectionEnd.position()) { if (cursor.position() == m_currentRenameSelectionEnd.position()
// Eat delete at end of name && !cursor.hasSelection()) {
// Eat delete at end of name when there is no selection
e->accept(); e->accept();
return; return;
} }