summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-03-25 16:44:41 +0100
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-03-25 19:32:44 +0100
commitaa5899ad40ba47c03861c193aab3ccfe33e3b3b4 (patch)
tree919f6359229f7a55edfd65669e0070aad3ea3606
parent86206782702cffe1a9af08f3e2b995620e05b7de (diff)
downloadqt-creator-aa5899ad40ba47c03861c193aab3ccfe33e3b3b4.tar.gz
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
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 0074c8f558..37772f4b8c 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -1795,16 +1795,18 @@ void CPPEditor::keyPressEvent(QKeyEvent *e)
break;
}
case Qt::Key_Backspace: {
- if (cursor.position() == m_currentRenameSelectionBegin.position()) {
- // Eat backspace at start of name
+ if (cursor.position() == m_currentRenameSelectionBegin.position()
+ && !cursor.hasSelection()) {
+ // Eat backspace at start of name when there is no selection
e->accept();
return;
}
break;
}
case Qt::Key_Delete: {
- if (cursor.position() == m_currentRenameSelectionEnd.position()) {
- // Eat delete at end of name
+ if (cursor.position() == m_currentRenameSelectionEnd.position()
+ && !cursor.hasSelection()) {
+ // Eat delete at end of name when there is no selection
e->accept();
return;
}