Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions frontend/src/ts/input/handlers/before-insert-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ export function onBeforeInsertText(data: string): boolean {
}

const { inputValue } = getInputElementValue();
const currentWordTextWithCommit =
TestWords.words.getCurrent()?.textWithCommit ?? "";
const currentWordObj = TestWords.words.getCurrent();
const currentWordTextWithCommit = currentWordObj?.textWithCommit ?? "";
const currentWordTextDisplay = currentWordObj?.display ?? "";

//normalize visually-equivalent chars (e.g. IME U+3000 space) to the target
//char, matching onInsertText, so commit classification is consistent
Expand Down Expand Up @@ -85,7 +86,7 @@ export function onBeforeInsertText(data: string): boolean {
// this will not work for the first word of each line, but that has a low chance of happening
const dataIsNotFalsy = data !== null && data !== "";
const inputIsLongerThanOrEqualToWord =
getCurrentInput().length >= currentWordTextWithCommit.length;
getCurrentInput().length >= currentWordTextDisplay.length;

if (
!SlowTimer.get() && // don't do this check if slow timer is active
Expand Down
Loading