@@ -123,10 +123,10 @@ function backspaceToPrevious(): void {
123123
124124 const wordElements = document . querySelectorAll ( "#words > .word" ) ;
125125 if (
126- ( TestInput . input . history [ TestWords . words . currentIndex - 1 ] ==
127- TestWords . words . get ( TestWords . words . currentIndex - 1 ) &&
126+ ( TestInput . input . history [ TestState . activeWordIndex - 1 ] ==
127+ TestWords . words . get ( TestState . activeWordIndex - 1 ) &&
128128 ! Config . freedomMode ) ||
129- wordElements [ TestWords . words . currentIndex - 1 ] ?. classList . contains ( "hidden" )
129+ wordElements [ TestState . activeWordIndex - 1 ] ?. classList . contains ( "hidden" )
130130 ) {
131131 return ;
132132 }
@@ -136,7 +136,7 @@ function backspaceToPrevious(): void {
136136 }
137137
138138 const incorrectLetterBackspaced =
139- wordElements [ TestWords . words . currentIndex ] ?. children [ 0 ] ?. classList . contains (
139+ wordElements [ TestState . activeWordIndex ] ?. children [ 0 ] ?. classList . contains (
140140 "incorrect"
141141 ) ;
142142 if ( Config . stopOnError === "letter" && incorrectLetterBackspaced ) {
@@ -149,7 +149,7 @@ function backspaceToPrevious(): void {
149149 TestInput . input . current = TestInput . input . current . slice ( 0 , - 1 ) ;
150150 setWordsInput ( " " + TestInput . input . current + " " ) ;
151151 }
152- TestWords . words . decreaseCurrentIndex ( ) ;
152+ TestState . decreaseActiveWordIndex ( ) ;
153153 TestUI . setActiveWordElementIndex ( TestUI . activeWordElementIndex - 1 ) ;
154154 TestUI . updateActiveElement ( true ) ;
155155 Funbox . toggleScript ( TestWords . words . getCurrent ( ) ) ;
@@ -219,10 +219,10 @@ async function handleSpace(): Promise<void> {
219219 }
220220 PaceCaret . handleSpace ( true , currentWord ) ;
221221 TestInput . input . pushHistory ( ) ;
222- TestWords . words . increaseCurrentIndex ( ) ;
222+ TestState . increaseActiveWordIndex ( ) ;
223223 Funbox . toggleScript ( TestWords . words . getCurrent ( ) ) ;
224224 TestInput . incrementKeypressCount ( ) ;
225- TestInput . pushKeypressWord ( TestWords . words . currentIndex ) ;
225+ TestInput . pushKeypressWord ( TestState . activeWordIndex ) ;
226226 if ( ! nospace ) {
227227 void Sound . playClick ( ) ;
228228 }
@@ -271,10 +271,10 @@ async function handleSpace(): Promise<void> {
271271 TestUI . highlightBadWord ( TestUI . activeWordElementIndex ) ;
272272 }
273273 TestInput . input . pushHistory ( ) ;
274- TestWords . words . increaseCurrentIndex ( ) ;
274+ TestState . increaseActiveWordIndex ( ) ;
275275 Funbox . toggleScript ( TestWords . words . getCurrent ( ) ) ;
276276 TestInput . incrementKeypressCount ( ) ;
277- TestInput . pushKeypressWord ( TestWords . words . currentIndex ) ;
277+ TestInput . pushKeypressWord ( TestState . activeWordIndex ) ;
278278 Replay . addReplayEvent ( "submitErrorWord" ) ;
279279 if ( Config . difficulty === "expert" || Config . difficulty === "master" ) {
280280 TestLogic . fail ( "difficulty" ) ;
@@ -283,7 +283,7 @@ async function handleSpace(): Promise<void> {
283283
284284 TestInput . corrected . pushHistory ( ) ;
285285
286- const isLastWord = TestWords . words . currentIndex === TestWords . words . length ;
286+ const isLastWord = TestState . activeWordIndex === TestWords . words . length ;
287287 if ( TestLogic . areAllTestWordsGenerated ( ) && isLastWord ) {
288288 void TestLogic . finish ( ) ;
289289 return ;
@@ -656,7 +656,7 @@ function handleChar(
656656 }
657657
658658 TestInput . incrementKeypressCount ( ) ;
659- TestInput . pushKeypressWord ( TestWords . words . currentIndex ) ;
659+ TestInput . pushKeypressWord ( TestState . activeWordIndex ) ;
660660
661661 if (
662662 Config . difficulty !== "master" &&
@@ -682,7 +682,7 @@ function handleChar(
682682 ? TestInput . input . current . length
683683 : Hangul . disassemble ( TestInput . input . current ) . length ;
684684 //update the active word top, but only once
685- if ( testInputLength === 1 && TestWords . words . currentIndex === 0 ) {
685+ if ( testInputLength === 1 && TestState . activeWordIndex === 0 ) {
686686 TestUI . setActiveWordTop ( activeWord ?. offsetTop ) ;
687687 }
688688
@@ -707,7 +707,7 @@ function handleChar(
707707 //auto stop the test if the last word is correct
708708 //do not stop if not all characters have been parsed by handleChar yet
709709 const currentWord = TestWords . words . getCurrent ( ) ;
710- const lastWordIndex = TestWords . words . currentIndex ;
710+ const lastWordIndex = TestState . activeWordIndex ;
711711 const lastWord = lastWordIndex === TestWords . words . length - 1 ;
712712 const allWordGenerated = TestLogic . areAllTestWordsGenerated ( ) ;
713713 const wordIsTheSame = currentWord === TestInput . input . current ;
@@ -1061,8 +1061,8 @@ $(document).on("keydown", async (event) => {
10611061 TestInput . input . current . slice ( - 1 ) ,
10621062 TestInput . input . current . length - 1
10631063 ) &&
1064- ( TestInput . input . history [ TestWords . words . currentIndex - 1 ] !=
1065- TestWords . words . get ( TestWords . words . currentIndex - 1 ) ||
1064+ ( TestInput . input . history [ TestState . activeWordIndex - 1 ] !=
1065+ TestWords . words . get ( TestState . activeWordIndex - 1 ) ||
10661066 Config . freedomMode )
10671067 ) {
10681068 TestInput . input . current = "" ;
0 commit comments