Skip to content

Let the keyboard alone decide a sentence start - #918

Merged
enaboapps merged 1 commit into
mainfrom
910-sentence-start
Sep 27, 2026
Merged

enaboapps merged 1 commit into
mainfrom
910-sentence-start

Conversation

@enaboapps

Copy link
Copy Markdown
Contributor

Closes #910. Part of the casing plan in #914.

What changed

  • The private worker query carries sentence_start, the keyboard's pending automatic capital: a full stop, exclamation or question mark it typed, not yet followed by a letter, and not cancelled by pressing Shift. In-process pipe message only; no persisted schema change.
  • The worker capitalises a suggestion's first letter from that flag alone. Its own guess, from punctuation seen in the buffer or the bare start of the buffer after a reset, is removed along with the sentence_start field of the extracted context. Prefix and preceding-text extraction are unchanged.
  • The cached-batch key includes the flag, so a change in the keyboard's state refreshes the row.
  • The old test that capitalised from "Done! " in the buffer now asserts that buffer punctuation alone gives "water" and the keyboard's flag gives "Water". Modifier combinations at a sentence start are tested with the flag set.
  • docs/word-prediction.md explains that the keyboard alone decides.

Behaviour change worth knowing: at the true start of a document, with nothing typed and no punctuation, the keyboard has no signal, so the first word is not auto-capitalised. Shift once gives "Water". Before, the worker guessed a capital at the bare start of its buffer, which was right at a document start and wrong mid-line.

Validation

Node 24.13.0, Rust 1.97.1:

  • npm run lint, npm test (244 Vitest tests and 5 Node tests) and npm run build passed. No frontend files changed.
  • cargo fmt --check and cargo clippy --all-targets -D warnings passed.
  • cargo test passed: 567 tests.

🤖 Generated with Claude Code

Two rules decided sentence starts independently: the keyboard after a
sentence mark it typed, and the worker after any of several marks it
saw in its buffer, or at the bare start of that buffer, which is often
mid-line after a reset. Each could fire without the other. The keyboard
now sends its pending automatic capital with each query and the worker
uses only that, so a suggestion never disagrees with the keyboard's own
Shift, and a person who cancelled the capital is respected. The worker's
own sentence-start guess is removed.

Closes #910

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps enaboapps added this to the v1.0.0-rc.16 milestone Sep 26, 2026
@enaboapps
enaboapps marked this pull request as ready for review September 26, 2026 11:13
@enaboapps
enaboapps merged commit e1bdc31 into main Sep 27, 2026
6 checks passed
@enaboapps
enaboapps deleted the 910-sentence-start branch September 27, 2026 10:44
@enaboapps enaboapps mentioned this pull request Sep 27, 2026
7 tasks done
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.

Make one sentence-start decision shared by keyboard and worker

2 participants