Fix "unknown keyboard accel" with 1-char translations

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.
This commit is contained in:
Václav Slavík
2017-04-03 16:52:53 +02:00
committed by Václav Slavík
parent 200ea47519
commit 166f5c0abb

View File

@@ -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"),