From 48d018800ff05368d13a71848744144ae2a84b54 Mon Sep 17 00:00:00 2001 From: Ihar Hubchyk Date: Sun, 24 Dec 2023 19:50:27 +0800 Subject: [PATCH] Take into an account SHIFT and CAPS LOCK being used at the same time (#8169) --- src/engine/localevent.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine/localevent.cpp b/src/engine/localevent.cpp index 4d362dbc87f..17c3d5ca43e 100644 --- a/src/engine/localevent.cpp +++ b/src/engine/localevent.cpp @@ -340,8 +340,12 @@ namespace return modifier; } - char getCharacterFromPressedKey( const fheroes2::Key key, const int32_t mod ) + char getCharacterFromPressedKey( const fheroes2::Key key, int32_t mod ) { + if ( ( mod & fheroes2::KeyModifier::KEY_MODIFIER_SHIFT ) && ( mod & fheroes2::KeyModifier::KEY_MODIFIER_CAPS ) ) { + mod = mod & ~( fheroes2::KeyModifier::KEY_MODIFIER_SHIFT | fheroes2::KeyModifier::KEY_MODIFIER_CAPS ); + } + switch ( key ) { case fheroes2::Key::KEY_1: return ( fheroes2::KeyModifier::KEY_MODIFIER_SHIFT & mod ? '!' : '1' );