fix(keymap): Handle more than 35 same keymap abbreviation (#497)
This commit is contained in:
committed by
László Monda
parent
9e69098ad2
commit
62c5e9d88a
@@ -302,6 +302,18 @@ function generateAbbr(keymaps: Keymap[], abbr: string): string {
|
|||||||
while (keymaps.some((keymap: Keymap) => keymap.abbreviation === abbr)) {
|
while (keymaps.some((keymap: Keymap) => keymap.abbreviation === abbr)) {
|
||||||
abbr = abbr.substring(0, abbr.length - 1) + chars[position];
|
abbr = abbr.substring(0, abbr.length - 1) + chars[position];
|
||||||
++position;
|
++position;
|
||||||
|
if (position > chars.length) {
|
||||||
|
position = 0;
|
||||||
|
let firstCharIndex = chars.indexOf(abbr.substr(0, 1));
|
||||||
|
let secondCharIndex = chars.indexOf(abbr.substr(1, 1));
|
||||||
|
secondCharIndex++;
|
||||||
|
|
||||||
|
if (secondCharIndex > chars.length) {
|
||||||
|
secondCharIndex = 0;
|
||||||
|
firstCharIndex++;
|
||||||
|
}
|
||||||
|
abbr = chars[firstCharIndex] + chars[secondCharIndex] + chars[position];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return abbr;
|
return abbr;
|
||||||
|
|||||||
Reference in New Issue
Block a user