fixed incorrect index in some specific cases

fixed accuracy calculation when swipe typing
could be part of #3690
This commit is contained in:
Miodec 2023-03-21 14:13:14 +01:00
parent 8bea978fd5
commit 1e4f1c66f0

View file

@ -1063,9 +1063,14 @@ $("#wordsInput").on("input", (event) => {
diffStart++;
}
let iOffset = 0;
if (/.+ .+/.test(inputValue)) {
iOffset = inputValue.indexOf(" ") + 1;
console.log("iOffset", iOffset);
}
for (let i = diffStart; i < inputValue.length; i++) {
// passing realInput to allow for correct Korean character compilation
handleChar(inputValue[i], i, realInputValue);
handleChar(inputValue[i], i - iOffset, realInputValue);
}
}