[BUGFIX] Fix support for non-Latin characters (#1072)

* solve 1068

* resolve problems

* resolve npm problem

* Merge master and rebuild, fix lint error

* Create fresh package-lock.json

Co-authored-by: محمدرضا ضربی زاده <mohammad.zarbizadeh@samim.net>
Co-authored-by: Matt Triff <matt.triff@gmail.com>
This commit is contained in:
Morez 2022-11-29 10:01:01 -08:00 committed by GitHub
parent a7ed4d880e
commit 312971acea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 16 deletions

16
package-lock.json generated
View File

@ -8082,9 +8082,9 @@
}
},
"node_modules/lint-staged/node_modules/listr2": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.5.tgz",
"integrity": "sha512-DpBel6fczu7oQKTXMekeprc0o3XDgGMkD7JNYyX+X0xbwK+xgrx9dcyKoXKqpLSUvAWfmoePS7kavniOcq3r4w==",
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.6.tgz",
"integrity": "sha512-u60KxKBy1BR2uLJNTWNptzWQ1ob/gjMzIJPZffAENzpZqbMZ/5PrXXOomDcevIS/+IB7s1mmCEtSlT2qHWMqag==",
"dev": true,
"dependencies": {
"cli-truncate": "^2.1.0",
@ -8092,7 +8092,7 @@
"log-update": "^4.0.0",
"p-map": "^4.0.0",
"rfdc": "^1.3.0",
"rxjs": "^7.5.6",
"rxjs": "^7.5.7",
"through": "^2.3.8",
"wrap-ansi": "^7.0.0"
},
@ -19643,9 +19643,9 @@
"dev": true
},
"listr2": {
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.5.tgz",
"integrity": "sha512-DpBel6fczu7oQKTXMekeprc0o3XDgGMkD7JNYyX+X0xbwK+xgrx9dcyKoXKqpLSUvAWfmoePS7kavniOcq3r4w==",
"version": "5.0.6",
"resolved": "https://registry.npmjs.org/listr2/-/listr2-5.0.6.tgz",
"integrity": "sha512-u60KxKBy1BR2uLJNTWNptzWQ1ob/gjMzIJPZffAENzpZqbMZ/5PrXXOomDcevIS/+IB7s1mmCEtSlT2qHWMqag==",
"dev": true,
"requires": {
"cli-truncate": "^2.1.0",
@ -19653,7 +19653,7 @@
"log-update": "^4.0.0",
"p-map": "^4.0.0",
"rfdc": "^1.3.0",
"rxjs": "^7.5.6",
"rxjs": "^7.5.7",
"through": "^2.3.8",
"wrap-ansi": "^7.0.0"
},

View File

@ -1264,7 +1264,8 @@ var Choices = /** @class */function () {
var hasActiveDropdown = this.dropdown.isActive;
var hasItems = this.itemList.hasChildren();
var keyString = String.fromCharCode(keyCode);
var wasAlphaNumericChar = /[a-zA-Z0-9-_ ]/.test(keyString);
// eslint-disable-next-line no-control-regex
var wasPrintableChar = /[^\x00-\x1F]/.test(keyString);
var BACK_KEY = constants_1.KEY_CODES.BACK_KEY,
DELETE_KEY = constants_1.KEY_CODES.DELETE_KEY,
ENTER_KEY = constants_1.KEY_CODES.ENTER_KEY,
@ -1274,7 +1275,7 @@ var Choices = /** @class */function () {
DOWN_KEY = constants_1.KEY_CODES.DOWN_KEY,
PAGE_UP_KEY = constants_1.KEY_CODES.PAGE_UP_KEY,
PAGE_DOWN_KEY = constants_1.KEY_CODES.PAGE_DOWN_KEY;
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericChar) {
if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) {
this.showDropdown();
if (!this.input.isFocussed) {
/*
@ -1282,7 +1283,7 @@ var Choices = /** @class */function () {
the input was not focussed at the time of key press
therefore does not have the value of the key.
*/
this.input.value += keyString.toLowerCase();
this.input.value += event.key.toLowerCase();
}
}
switch (keyCode) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1441,7 +1441,8 @@ class Choices implements Choices {
const hasActiveDropdown = this.dropdown.isActive;
const hasItems = this.itemList.hasChildren();
const keyString = String.fromCharCode(keyCode);
const wasAlphaNumericChar = /[a-zA-Z0-9-_ ]/.test(keyString);
// eslint-disable-next-line no-control-regex
const wasPrintableChar = /[^\x00-\x1F]/.test(keyString);
const {
BACK_KEY,
@ -1455,7 +1456,7 @@ class Choices implements Choices {
PAGE_DOWN_KEY,
} = KEY_CODES;
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericChar) {
if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) {
this.showDropdown();
if (!this.input.isFocussed) {
@ -1464,7 +1465,7 @@ class Choices implements Choices {
the input was not focussed at the time of key press
therefore does not have the value of the key.
*/
this.input.value += keyString.toLowerCase();
this.input.value += event.key.toLowerCase();
}
}