File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -35,12 +35,12 @@ const KeyboardShortcuts = {
3535
3636 bind : keymap => {
3737 each ( keymap , ( fn , key ) => {
38- // Resolve platform‑ specific modifiers and remove duplicates.
38+ // Resolve platform- specific modifiers and remove duplicates.
3939 const rawKeys = key
4040 . toLowerCase ( )
4141 . split ( "," )
4242 . map ( trim ) ;
43- // Translate platform‑ specific modifiers and dedupe.
43+ // Translate platform- specific modifiers and dedupe.
4444 const transformed = rawKeys . map ( k =>
4545 k . replace ( / m o d / g, modKey . toLowerCase ( ) )
4646 ) ;
@@ -54,13 +54,18 @@ const KeyboardShortcuts = {
5454
5555 unbind : keymap => {
5656 each ( keymap , ( fn , key ) => {
57- const keys = key
57+ const rawKeys = key
5858 . toLowerCase ( )
5959 . split ( "," )
6060 . map ( trim ) ;
61- each ( keys , k => {
61+ // Apply the same transformation as in bind
62+ const transformed = rawKeys . map ( k =>
63+ k . replace ( / m o d / g, modKey . toLowerCase ( ) )
64+ ) ;
65+ const uniqueKeys = [ ...new Set ( transformed ) ] ;
66+ each ( uniqueKeys , k => {
6267 handlers [ k ] = without ( handlers [ k ] , fn ) ;
63- if ( handlers [ k ] . length === 0 ) {
68+ if ( ! handlers [ k ] || handlers [ k ] . length === 0 ) {
6469 handlers [ k ] = undefined ;
6570 Mousetrap . unbind ( k ) ;
6671 }
You can’t perform that action at this time.
0 commit comments