From 2599ae45d67a4f8fbff49a6b366c28062d7a7328 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 18 May 2021 21:05:46 +0300 Subject: [PATCH] Fixed handle of last message on Up arrow in sections with key modifiers. --- .../view/controls/history_view_compose_controls.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index 59ed60ed3..2988b0cd3 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -1083,20 +1083,22 @@ void ComposeControls::initKeyHandler() { auto keyEvent = static_cast(e.get()); const auto key = keyEvent->key(); const auto isCtrl = keyEvent->modifiers() == Qt::ControlModifier; + const auto hasModifiers = keyEvent->modifiers() != Qt::NoModifier; if (key == Qt::Key_O && isCtrl) { _attachRequests.fire({}); return; } - if (key == Qt::Key_Up) { + if (key == Qt::Key_Up && !hasModifiers) { if (!isEditingMessage()) { _editLastMessageRequests.fire(std::move(keyEvent)); return; } } - if ((key == Qt::Key_Up) - || (key == Qt::Key_Down) - || (key == Qt::Key_PageUp) - || (key == Qt::Key_PageDown)) { + if (!hasModifiers + && ((key == Qt::Key_Up) + || (key == Qt::Key_Down) + || (key == Qt::Key_PageUp) + || (key == Qt::Key_PageDown))) { _scrollKeyEvents.fire(std::move(keyEvent)); } }, _wrap->lifetime());