Editor: only start block selection if alt and shift is pressed

Since it is a selection the shift modifier should be part off the
shortcuts and the old block selection also required both modifiers.
Additionally this prevents creating a block selection by accident when
there are no items in the editor history since alt + arrow left is
mapped to go back in history by default.

Change-Id: I46b0753a737f1e1b3c980d2e959bcf7b4733d790
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2022-02-25 07:50:05 +01:00
parent 47667772c7
commit 4d10a2df36

View File

@@ -2609,7 +2609,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e)
if (ro || !isPrintableText(eventText)) {
QTextCursor::MoveOperation blockSelectionOperation = QTextCursor::NoMove;
if (e->modifiers() & Qt::AltModifier && !Utils::HostOsInfo::isMacHost()) {
if (e->modifiers() == (Qt::AltModifier | Qt::ShiftModifier) && !Utils::HostOsInfo::isMacHost()) {
if (MultiTextCursor::multiCursorAddEvent(e, QKeySequence::MoveToNextLine))
blockSelectionOperation = QTextCursor::Down;
else if (MultiTextCursor::multiCursorAddEvent(e, QKeySequence::MoveToPreviousLine))