diff --git a/frontend/src/ts/input/handlers/insert-text.ts b/frontend/src/ts/input/handlers/insert-text.ts index 4b577eece08c..6c0eef3c833b 100644 --- a/frontend/src/ts/input/handlers/insert-text.ts +++ b/frontend/src/ts/input/handlers/insert-text.ts @@ -174,7 +174,7 @@ export async function onInsertText(options: OnInsertTextParams): Promise { if (Config.keymapMode === "react") { flash(data, correct); } - if (testInput.length === 0) { + if (testInput.length === 0 && !isCompositionEnding) { TestInput.setBurstStart(now); } if (!shouldGoToNextWord) { diff --git a/frontend/src/ts/input/listeners/composition.ts b/frontend/src/ts/input/listeners/composition.ts index f8ed5ebda1e0..c43568e1b6a7 100644 --- a/frontend/src/ts/input/listeners/composition.ts +++ b/frontend/src/ts/input/listeners/composition.ts @@ -2,6 +2,7 @@ import { getInputElement } from "../input-element"; import * as CompositionState from "../../legacy-states/composition"; import * as TestState from "../../test/test-state"; import * as TestLogic from "../../test/test-logic"; +import * as TestInput from "../../test/test-input"; import { setLastInsertCompositionTextData } from "../state"; import * as CompositionDisplay from "../../elements/composition-display"; import { onInsertText } from "../handlers/insert-text"; @@ -22,6 +23,9 @@ inputEl.addEventListener("compositionstart", (event) => { if (!TestState.isActive) { TestLogic.startTest(performance.now()); } + if (TestInput.input.current.length === 0) { + TestInput.setBurstStart(performance.now()); + } }); inputEl.addEventListener("compositionupdate", (event) => { diff --git a/frontend/src/ts/test/test-stats.ts b/frontend/src/ts/test/test-stats.ts index 09b1822c59b5..392683b16781 100644 --- a/frontend/src/ts/test/test-stats.ts +++ b/frontend/src/ts/test/test-stats.ts @@ -215,6 +215,7 @@ export function setLastSecondNotRound(): void { export function calculateBurst(endTime: number = performance.now()): number { const containsKorean = TestInput.input.getKoreanStatus(); const timeToWrite = (endTime - TestInput.currentBurstStart) / 1000; + if (timeToWrite <= 0) return 0; let wordLength: number; wordLength = !containsKorean ? TestInput.input.current.length