From 4d10a2df36397ddde39135a42c0201022d1b61d0 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 25 Feb 2022 07:50:05 +0100 Subject: [PATCH] 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 --- src/plugins/texteditor/texteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 81c833e72ed..e0f1afe2d6f 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -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))