@@ -87,15 +87,15 @@ export class KeybindingResolver {
87
87
*/
88
88
public static handleRemovals ( rules : ResolvedKeybindingItem [ ] ) : ResolvedKeybindingItem [ ] {
89
89
// Do a first pass and construct a hash-map for removals
90
- const removals = new Map < string , { maxIndex : number ; rule : ResolvedKeybindingItem ; } [ ] > ( ) ;
90
+ const removals = new Map < string , ResolvedKeybindingItem [ ] > ( ) ;
91
91
for ( let i = 0 , len = rules . length ; i < len ; i ++ ) {
92
92
const rule = rules [ i ] ;
93
93
if ( rule . command && rule . command . charAt ( 0 ) === '-' ) {
94
94
const command = rule . command . substring ( 1 ) ;
95
95
if ( ! removals . has ( command ) ) {
96
- removals . set ( command , [ { maxIndex : i , rule } ] ) ;
96
+ removals . set ( command , [ rule ] ) ;
97
97
} else {
98
- removals . get ( command ) ! . push ( { maxIndex : i , rule } ) ;
98
+ removals . get ( command ) ! . push ( rule ) ;
99
99
}
100
100
}
101
101
}
@@ -118,21 +118,16 @@ export class KeybindingResolver {
118
118
continue ;
119
119
}
120
120
const commandRemovals = removals . get ( rule . command ) ;
121
- if ( ! commandRemovals ) {
121
+ if ( ! commandRemovals || ! rule . isDefault ) {
122
122
result . push ( rule ) ;
123
123
continue ;
124
124
}
125
125
let isRemoved = false ;
126
126
for ( const commandRemoval of commandRemovals ) {
127
- if ( i > commandRemoval . maxIndex ) {
128
- // this command removal is above this rule, so it cannot influence it
129
- continue ;
130
- }
131
- const removalRule = commandRemoval . rule ;
132
127
// TODO@chords
133
- const keypressFirstPart = removalRule . keypressParts [ 0 ] ;
134
- const keypressChordPart = removalRule . keypressParts [ 1 ] ;
135
- const when = removalRule . when ;
128
+ const keypressFirstPart = commandRemoval . keypressParts [ 0 ] ;
129
+ const keypressChordPart = commandRemoval . keypressParts [ 1 ] ;
130
+ const when = commandRemoval . when ;
136
131
if ( this . _isTargetedForRemoval ( rule , keypressFirstPart , keypressChordPart , when ) ) {
137
132
isRemoved = true ;
138
133
break ;
0 commit comments