summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.js5
1 files changed, 4 insertions, 1 deletions
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
}
}