From 587783bdbf7228c7c1c825ccce5df6403db7ab20 Mon Sep 17 00:00:00 2001 From: Nick Van Doorn Date: Fri, 27 Mar 2020 15:24:37 -0700 Subject: Reset incorrect portion of word --- main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index b8ece73..d08f324 100644 --- a/main.js +++ b/main.js @@ -52,7 +52,10 @@ state.set({ currentWordIndex: currentWordIndex + 1, currentMatchIndex: 0 }) } else { - state.set({ currentMatchIndex: currentMatchPosition(currentWord) }) + const currentMatchIndex = currentMatchPosition(currentWord) + const correctSegment = mainInput.value.slice(0, currentMatchIndex) + state.set({ currentMatchIndex }) + mainInput.value = correctSegment } } -- cgit v1.2.3