@@ -1602,7 +1602,7 @@ define(function (require, exports, module) {
16021602 } ) ;
16031603 } else {
16041604 // Just resolve if no user key map file
1605- result . resolve ( ) ;
1605+ result . resolve ( { } ) ;
16061606 }
16071607 } ) ;
16081608 return result . promise ( ) ;
@@ -1624,7 +1624,7 @@ define(function (require, exports, module) {
16241624 console . log ( "registering custom keymap pack" , packID , packName ) ;
16251625 _registeredCustomKeyMaps [ packID ] = {
16261626 packageName : packName ,
1627- keyMap : keyMap
1627+ keyMap : _getNormalisedKeyMap ( keyMap )
16281628 } ;
16291629 if ( _customKeymapIDInUse === packID ) {
16301630 _loadUserKeyMap ( ) ;
@@ -1651,6 +1651,7 @@ define(function (require, exports, module) {
16511651 * @returns {string|null } - The origin of the custom shortcut, or null if it is not a custom shortcut.
16521652 */
16531653 function getCustomShortcutOrigin ( shortcut ) {
1654+ shortcut = normalizeKeyDescriptorString ( shortcut ) ;
16541655 if ( _originalUserKeyMap . hasOwnProperty ( shortcut ) ) {
16551656 return Strings . KEYBOARD_SHORTCUT_SRC_USER ;
16561657 } else if ( _customKeyMap . hasOwnProperty ( shortcut ) && _customKeymapIDInUse &&
@@ -1693,6 +1694,20 @@ define(function (require, exports, module) {
16931694 }
16941695 }
16951696
1697+ function _getNormalisedKeyMap ( keyMap ) {
1698+ const normalisedKeyMap = { } ;
1699+ for ( let key of Object . keys ( keyMap ) ) {
1700+ try {
1701+ normalisedKeyMap [ normalizeKeyDescriptorString ( key ) ] = keyMap [ key ] ;
1702+ } catch ( e ) {
1703+ console . error ( "Error normalising user keymap key: " , key , e ) ;
1704+ // we will still inject the key with error as so that the error dialogs will come up as expected.
1705+ normalisedKeyMap [ key ] = keyMap [ key ] ;
1706+ }
1707+ }
1708+ return normalisedKeyMap ;
1709+ }
1710+
16961711 /**
16971712 * @private
16981713 *
@@ -1709,6 +1724,7 @@ define(function (require, exports, module) {
17091724 return new Promise ( ( resolve , reject ) => {
17101725 _readUserKeyMap ( )
17111726 . then ( function ( keyMap ) {
1727+ keyMap = _getNormalisedKeyMap ( keyMap ) ;
17121728 _originalUserKeyMap = structuredClone ( keyMap ) ;
17131729 _mixCustomKeyMaps ( keyMap ) ;
17141730 // Some extensions may add a new command without any key binding. So
0 commit comments