From 166f5c0abb3f54df403fe765528330975d97b148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Mon, 3 Apr 2017 16:52:53 +0200 Subject: [PATCH] Fix "unknown keyboard accel" with 1-char translations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wxAcceleratorEntry::ParseAccel() incorrectly assumes that every single-character accelerator must be a direct character code. But that's not true, a human-friendly name for a key (e.g. "Down") may be translated with a single character in some languages (or because a translator decides to use a Unicode arrow…). Amend the test to check if the character is a 7bit ASCII one. That would be extremely unlikely to be a translation. --- src/common/accelcmn.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/common/accelcmn.cpp b/src/common/accelcmn.cpp index f5bea8079a..132c7edb0c 100644 --- a/src/common/accelcmn.cpp +++ b/src/common/accelcmn.cpp @@ -232,12 +232,18 @@ wxAcceleratorEntry::ParseAccel(const wxString& text, int *flagsOut, int *keyOut) // it's just a letter keyCode = current[0U]; - // if the key is used with any modifiers, make it an uppercase one - // because Ctrl-A and Ctrl-a are the same; but keep it as is if it's - // used alone as 'a' and 'A' are different - if ( accelFlags != wxACCEL_NORMAL ) - keyCode = wxToupper(keyCode); - break; + // ...or maybe not. A translation may be single character too (e.g. + // Chinese), but if it's a Latin character, that's unlikely + if ( keyCode < 128 ) + { + // if the key is used with any modifiers, make it an uppercase one + // because Ctrl-A and Ctrl-a are the same; but keep it as is if it's + // used alone as 'a' and 'A' are different + if ( accelFlags != wxACCEL_NORMAL ) + keyCode = wxToupper(keyCode); + break; + } + wxFALLTHROUGH; default: keyCode = IsNumberedAccelKey(current, wxTRANSLATE("F"),