From 428e0f87b71f38e21660abafda0e4088f1b2006a Mon Sep 17 00:00:00 2001 From: Nad Alaba <37968805+nadalaba@users.noreply.github.com> Date: Wed, 8 Jul 2026 22:28:23 +0300 Subject: [PATCH] fix: word jumping to 3rd line when overflowing (@nadalaba) (#8210) https://github.com/user-attachments/assets/23197a0c-7b59-48e5-8a3d-460584a7df12 --- frontend/src/ts/input/handlers/before-insert-text.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/ts/input/handlers/before-insert-text.ts b/frontend/src/ts/input/handlers/before-insert-text.ts index 04254bf51ba6..458b4d374876 100644 --- a/frontend/src/ts/input/handlers/before-insert-text.ts +++ b/frontend/src/ts/input/handlers/before-insert-text.ts @@ -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 @@ -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