From 1e4f1c66f0fd8e4e24e774c8f4f9e7ccf2395033 Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 21 Mar 2023 14:13:14 +0100 Subject: [PATCH] fixed incorrect index in some specific cases fixed accuracy calculation when swipe typing could be part of #3690 --- frontend/src/ts/controllers/input-controller.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/ts/controllers/input-controller.ts b/frontend/src/ts/controllers/input-controller.ts index b524a0927..e18cab030 100644 --- a/frontend/src/ts/controllers/input-controller.ts +++ b/frontend/src/ts/controllers/input-controller.ts @@ -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); } }