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

View file

@ -1264,7 +1264,8 @@ var Choices = /** @class */function () {
var hasActiveDropdown = this.dropdown.isActive; var hasActiveDropdown = this.dropdown.isActive;
var hasItems = this.itemList.hasChildren(); var hasItems = this.itemList.hasChildren();
var keyString = String.fromCharCode(keyCode); 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, var BACK_KEY = constants_1.KEY_CODES.BACK_KEY,
DELETE_KEY = constants_1.KEY_CODES.DELETE_KEY, DELETE_KEY = constants_1.KEY_CODES.DELETE_KEY,
ENTER_KEY = constants_1.KEY_CODES.ENTER_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, DOWN_KEY = constants_1.KEY_CODES.DOWN_KEY,
PAGE_UP_KEY = constants_1.KEY_CODES.PAGE_UP_KEY, PAGE_UP_KEY = constants_1.KEY_CODES.PAGE_UP_KEY,
PAGE_DOWN_KEY = constants_1.KEY_CODES.PAGE_DOWN_KEY; PAGE_DOWN_KEY = constants_1.KEY_CODES.PAGE_DOWN_KEY;
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericChar) { if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) {
this.showDropdown(); this.showDropdown();
if (!this.input.isFocussed) { if (!this.input.isFocussed) {
/* /*
@ -1282,7 +1283,7 @@ var Choices = /** @class */function () {
the input was not focussed at the time of key press the input was not focussed at the time of key press
therefore does not have the value of the key. therefore does not have the value of the key.
*/ */
this.input.value += keyString.toLowerCase(); this.input.value += event.key.toLowerCase();
} }
} }
switch (keyCode) { 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 hasActiveDropdown = this.dropdown.isActive;
const hasItems = this.itemList.hasChildren(); const hasItems = this.itemList.hasChildren();
const keyString = String.fromCharCode(keyCode); 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 { const {
BACK_KEY, BACK_KEY,
@ -1455,7 +1456,7 @@ class Choices implements Choices {
PAGE_DOWN_KEY, PAGE_DOWN_KEY,
} = KEY_CODES; } = KEY_CODES;
if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericChar) { if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) {
this.showDropdown(); this.showDropdown();
if (!this.input.isFocussed) { if (!this.input.isFocussed) {
@ -1464,7 +1465,7 @@ class Choices implements Choices {
the input was not focussed at the time of key press the input was not focussed at the time of key press
therefore does not have the value of the key. therefore does not have the value of the key.
*/ */
this.input.value += keyString.toLowerCase(); this.input.value += event.key.toLowerCase();
} }
} }