Commit aa5899ad authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

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
parent 86206782
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment