Conversation
Bind contraction auto-correction to the candidate being evaluated and promote that existing transformed entry only when correction is allowed. Prefer available canonical spellings while preserving typed alternatives, capitalization, whitelist and shortcut intent. Cover ranked distractors, canonical casing, disabled and resumed input, known words, multilingual input, dictionary shortcuts, and the space-commit path with deterministic Robolectric regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The missing-apostrophe shortcut in
Suggest.shouldBeAutoCorrectedfinds an expected contraction anywhere in the dictionary results, but returns an auto-correction decision for the pre-existing first candidate. For example,yourewith higher-rankedYoureoryoursand a lower-rankedyou'recan auto-correct to the distractor rather than the contraction that justified the decision.Change
COMMON_CONTRACTIONSwhen available: lower-rankedyou'reoverYou'refor unshifted input, but retain the map's intentionalI'mcapitalization and normal sentence-start/manual Shift/CapsLock transformations.Validation
Test-first fixtures on the original production code reproduced the wrong selected candidates (
Youre,yours, and others); the final cases pass after the fix. Additional shortcut controls failed before their guard was added.Fresh XML results with Temurin JDK 21 and the existing Android SDK:
SuggestTest: 33 passed, no failures/errors/skips.InputLogicTest: 90 passed, no failures/errors; one unchanged pre-existing ignored Hangul test (insertLetterIntoWordHangulFails).Coverage includes a contraction beyond the visible strip, higher capitalized rivals, typed alternatives and raw results, capitalization/deduplication, trailing quotes, correction disabled, resumed words, unavailable main dictionaries, known English/French words, already-correct
you're, English secondary-language candidates, whitelist/shortcut controls, and synthetic space commits producingI think you're.The initially attempted
testOfflineDebugUnitTestis blocked by the existing test-manifest minSdk 21 /androidx.graphics:graphics-path:1.1.0minSdk 23 mismatch. No build configuration, dependency, baseline, or ignore was changed.Scope
This fixes controlled-candidate selection, not dictionary availability or broad capitalization/ranking policy. It does not synthesize absent words, force lowercase when no lowercase candidate exists, change scoring algorithms, modify editor caps/context handling, or address TextExpander behavior. WhatsApp/Discord and the user's device were not reproduced; the integration evidence is deterministic Robolectric execution with injected dictionary results.
Related symptom discussion: #482. This does not claim to resolve or close that broader report.