pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.2k stars 355 forks source link

Menu items in System Browser use mixed case for keyboard shortcuts #13721

Open Rinzwind opened 1 year ago

Rinzwind commented 1 year ago

Within the context menus in the System Browser, the keyboard shortcuts are shown in a mixture of upper and lower case:

1

Build information: Pharo-12.0.0+build.328.sha.34ebfbe1a25f4b5a6af46fdab9cf417763422de1 (64 Bit)

Rinzwind commented 1 year ago

With the following reimplementation of #setUpShortcutTipForMenuItem in CmdCommandActivator (not intended as a fix, only as a demonstration):

setUpShortcutTipForMenuItem: aMenuItemMorph

    CmdShortcutActivation
        activeInstancesFor: command class inContext: context
        do: [ :shortcut |
            | keyText regex |
            keyText := shortcut keyCombination acceptVisitor: OSPlatform current shortcutPrinter.
            regex := '(⇧)?(⌘)?([A-Z])' asRegex.
            (regex matches: keyText) ifTrue: [
                keyText := String streamContents: [ :stream |
                    (regex subexpression: 2) ifNotNil: [ stream nextPutAll: 'shift+' ].
                    (regex subexpression: 3) ifNotNil: [ stream nextPutAll: 'cmd+' ].
                    stream nextPutAll: (regex subexpression: 4) ] ].
            aMenuItemMorph keyText: keyText ]

Some of the menu items that previously showed the keyboard shortcut in lower case are changed to show it in upper case:

2

Ducasse commented 1 year ago

Yes send a fix :)

jecisc commented 1 year ago

Can't we modify the menu implementation so that it's the UI that ensure everything is in uppercase?