Skip to content

Hold suggestions until the next word after context is lost mid-word - #927

Merged
enaboapps merged 3 commits into
mainfrom
926-hold-suggestions-after-reset
Sep 27, 2026
Merged

enaboapps merged 3 commits into
mainfrom
926-hold-suggestions-after-reset

Conversation

@enaboapps

@enaboapps enaboapps commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #926

Problem

After the prediction context was cleared in the middle of a word, the remaining letters were completed as if they began a new word. After hel, a further l could be completed to like, leaving hellike.

Change

Suggestions are held until a character that ends the word is typed, then resume with the next word. The badge reads "Suggestions resume next word" while held.

Context is cleared by Suggestions are held
A failed key, a failed acceptance, Retry predictions, a worker replaced after a missed deadline When a word is in progress
A shortcut When a word is in progress
An arrow key, Home, End, Page Up, Page Down, Delete or another untyped key Always
Backspace that deletes text the worker does not have When the character before the caret is part of a word or unknown
Enter or Tab Never
A foreground change or outside keyboard and mouse activity Never, and these end a hold
  • Backspace releases a hold once it deletes back to a space or punctuation Switchify typed.
  • The main process remembers, for each character Switchify typed, only whether it was part of a word. It stores no text, and at most 512 entries.

No pipe message, protocol interface or persisted schema changes.

Behaviour changes to be aware of

  • After a navigation key, the next word gets no suggestions.
  • Backspacing text that was there before the keyboard opened, then typing, gets no suggestions until the next word.

Both were cases where the old behaviour could complete a fragment into the wrong word. A hold costs at most one word of suggestions and never changes what is typed.

Difference from the issue

The issue proposed holding after any reset. Window changes and outside activity are excluded, because the caret may then be anywhere and typing usually starts a new word.

Validation

All run locally on Windows and passing:

  • npm run prediction-model
  • npm run lint
  • npm test
  • npm run build
  • cargo fmt --manifest-path src-tauri/Cargo.toml --check
  • cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings
  • cargo test --manifest-path src-tauri/Cargo.toml: 583 passed

New tests call the service directly with fake strokes and inject no input.

Not covered by a test: the failed acceptance path, which sits inside poll and needs an app handle. Not verified: behaviour in the running app.

🤖 Generated with Claude Code

When the prediction context is cleared inside a word and the caret has
not moved away, nothing is sent to the worker until a character that
ends the word is typed. The main process tracks only whether each typed
character was part of a word, never the text.

Closes #926

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps enaboapps added this to the v1.0.0-rc.16 milestone Sep 27, 2026
OwenMcGirr and others added 2 commits September 27, 2026 16:35
Review follow-up: a failed acceptance, a failed Enter, Tab or shortcut,
and a shortcut inside a word now hold. Navigation keys always hold.
Backspace into text the worker never had holds, and Backspace back to a
word boundary releases. An observer that is not running no longer ends
a hold.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Review follow-up: a space typed and deleted again after navigation or
a Backspace into unseen text holds again. The observer starting again
no longer ends a hold, the failed punctuation test asserts the hold,
and the native validation steps describe the held cases.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps
enaboapps marked this pull request as ready for review September 27, 2026 15:43
@enaboapps
enaboapps merged commit 16ed268 into main Sep 27, 2026
6 checks passed
@enaboapps
enaboapps deleted the 926-hold-suggestions-after-reset branch September 27, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hold suggestions until the next word after the prediction context resets mid-word

2 participants