File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ export class KeymapHeaderComponent implements OnChanges {
7272 }
7373
7474 editKeymapAbbr ( newAbbr : string ) {
75- if ( newAbbr . length !== 3 ) {
75+ const regexp = new RegExp ( / ^ [ a - z A - Z \d ] + $ / g) ;
76+
77+ if ( newAbbr . length < 1 || newAbbr . length > 3 || ! regexp . test ( newAbbr ) ) {
7678 this . renderer . setElementProperty ( this . keymapAbbr . nativeElement , 'value' , this . keymap . abbreviation ) ;
7779 return ;
7880 }
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ export function getMacro(id: number) {
274274}
275275
276276function generateAbbr ( keymaps : Keymap [ ] , abbr : string ) : string {
277- const chars : string [ ] = '23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ' . split ( '' ) ;
277+ const chars : string [ ] = '123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ' . split ( '' ) ;
278278 let position = 0 ;
279279
280280 while ( keymaps . some ( ( keymap : Keymap ) => keymap . abbreviation === abbr ) ) {
You can’t perform that action at this time.
0 commit comments