From c529a872409465174073bf49ad959505445767c8 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Fri, 30 Jun 2023 13:44:44 +0200 Subject: [PATCH] Terminal: fix keypad Enter key handling on Windows On Windows it looked like nothing happened when pressing the keypad's Enter key. By using the same handling as for the Return key, the terminal works as the user expects it. Fixes: QTCREATORBUG-29348 Change-Id: Ia49f0bb98aef8393f208671042d608a124cb431f Reviewed-by: Marcus Tillmanns --- src/plugins/terminal/keys.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/terminal/keys.cpp b/src/plugins/terminal/keys.cpp index f6a7a91b13d..ce14cbe5fbc 100644 --- a/src/plugins/terminal/keys.cpp +++ b/src/plugins/terminal/keys.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 +#include + #include "keys.h" namespace Terminal::Internal { @@ -72,8 +74,14 @@ VTermKey qtKeyToVTerm(Qt::Key key, bool keypad) return keypad ? VTERM_KEY_KP_PERIOD : VTERM_KEY_NONE; case Qt::Key_Slash: return keypad ? VTERM_KEY_KP_DIVIDE : VTERM_KEY_NONE; - case Qt::Key_Enter: - return keypad ? VTERM_KEY_KP_ENTER : VTERM_KEY_NONE; + case Qt::Key_Enter: { + VTermKey enterKey = VTERM_KEY_KP_ENTER; + + if (Utils::HostOsInfo::isWindowsHost()) + enterKey = VTERM_KEY_ENTER; + + return keypad ? enterKey : VTERM_KEY_NONE; + } case Qt::Key_Equal: return keypad ? VTERM_KEY_KP_EQUAL : VTERM_KEY_NONE; default: