Skip to content

Commit 62c5e9d

Browse files
ert78gbmondalaci
authored andcommitted
fix(keymap): Handle more than 35 same keymap abbreviation (#497)
1 parent 9e69098 commit 62c5e9d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/uhk-web/src/app/store/reducers/user-configuration.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,18 @@ function generateAbbr(keymaps: Keymap[], abbr: string): string {
302302
while (keymaps.some((keymap: Keymap) => keymap.abbreviation === abbr)) {
303303
abbr = abbr.substring(0, abbr.length - 1) + chars[position];
304304
++position;
305+
if (position > chars.length) {
306+
position = 0;
307+
let firstCharIndex = chars.indexOf(abbr.substr(0, 1));
308+
let secondCharIndex = chars.indexOf(abbr.substr(1, 1));
309+
secondCharIndex++;
310+
311+
if (secondCharIndex > chars.length) {
312+
secondCharIndex = 0;
313+
firstCharIndex++;
314+
}
315+
abbr = chars[firstCharIndex] + chars[secondCharIndex] + chars[position];
316+
}
305317
}
306318

307319
return abbr;

0 commit comments

Comments
 (0)