FR: Capitalize modifier key names in KeyPress::getTextDescription

In KeyPress::getTextDescription, the modifier key names generated are all lowercase.

In documentation from both Apple and Microsoft, when modifier keys are discussed, they are capitalized. This also seems to be the standard when modifier keys are shown in menubar command shortcuts on Windows (whereas macOS uses glyphs for modifier keys when displayed in system menubars).

It is simple to call String::toLowerCase if you desire an all-lowercase text description of a keypress. However, since there is no equivalent String::toCapitalized method, going the other way is a pain.

Therefore, I request that KeyPress::getTextDescription return modifier keys as capitalized words. It is the most “information-rich” format for those descriptions to be delivered in, and while it’s easy to strip capitalization information from Strings, it’s hard to add that back in.

To connect the dots about the importance of KeyPress::getTextDescription, that method generates the modifier key names that are shown in the JUCE MenuBarComponent in Windows.

So, e.g., instead of the Undo shortcut displaying as “Ctrl + Z”, in a JUCE app the default shortcut shows as “ctrl + Z”.

2 Likes