Conversation
fix(telex): tone placement on ao/eo clusters, d-adjacency, closed-syllable vowel reach-through
Refactor VietnameseTelexProcessor to handle non-Vietnamese syllables and improve tone application logic.
Added a method to pre-populate Vietnamese bigrams for next-word suggestions, ensuring new installs have initial predictions. This method seeds common word pairs with a low baseline count to encourage learning from user input.
Removed bailoutSyllable state management and replaced it with toneCancelledPrefix to handle tone cancellation more effectively. Updated logic in rewrite and applyToneKey methods to accommodate the new state.
test: fix window-visibility timing in CandidatesBarControllerTest setContentView() was called after the activity was already visible, so Robolectric never dispatched windowVisibility=VISIBLE to the new content view, failing the stricter isActuallyRendered() check added in the latest upstream release. Reordered to setContentView before the activity becomes visible, matching real Android lifecycle order.
Updated activity controller setup in test to ensure proper visibility and rendering of input view.
Updated window visibility dispatch logic in test.
Ensure window visibility is set for system-level rendering.
Collaborator
|
@Oxydox please tell me when you are ready for review |
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.
This PR fixes several real bugs found and verified through extensive day-to-day use of the Vietnamese Telex layout, plus one fix to the (locale-agnostic) suggestion engine and a next-word prediction improvement.
Telex fixes (VietnameseTelexProcessor.kt):
Tone marks landed on the wrong vowel in ao/eo diphthongs (e.g. "nao"+f → "naò" instead of "nào"), and in closed syllables like oan/oat (e.g. "toan"+s → "tóan" instead of "toán").
Non-adjacent letters incorrectly merged into đ (typing "d","e","s","t","r" would corrupt into duplicated/dropped letters).
Shape keys (a/e/o doubling) could reach back through an already-closed syllable coda and corrupt an earlier vowel (e.g. "mam"+"a" → "maam" instead of staying literal).
Added onset-validity checking so common English words typed while Telex is active (e.g. "wolf", "zoo", "stress", "straight") no longer get incorrectly converted in the first place.
Two letters that don't fit an already-converted word (e.g. an abbreviation like "đky", or a plain consonant after a complete word like "biết"+n) now insert literally after the word instead of corrupting the whole thing back to raw keystrokes. An earlier version of this fix used a broader rollback mechanism that also blocked legitimate tone-cycling on any word ending in a common coda (t/ch/ng/etc.) — replaced with narrower tracking of only explicitly-cancelled tones (same tone key pressed twice), so normal cycling (e.g. "biết" → "biệt" → "biết") always works.
đ's third-key-press escape now reverts fully to literal dd, matching how the other shape keys already escape (e.g. ô + o → oo). Previously it appended a literal d instead (đd). Confirmed against real device behavior before changing — this changes what one existing test expected, updated accordingly.
All changes verified against the full existing test suite (zero regressions) plus a broad set of real Vietnamese words with varied onsets/codas, and cross-checked against real typing patterns rather than synthetic examples alone.
Suggestion engine (SuggestionEngine.kt):
The "does this candidate have an accent" check was hardcoded to a small set of Italian-only accented characters, so it silently never fired for most Vietnamese diacritics (missed ô, ơ, ư, â, ă, đ, and any combined tone+shape mark). Replaced with the general NFD-based accent-stripping check already used elsewhere in the same file, so it works correctly for any language, not just Italian.
Next-word prediction (UserNGramStore.kt):
Previously started with zero data for every new install — no shipped bigram model at all. Added a small seed set of ~130 common Vietnamese word-pairs, inserted at a low baseline count so real usage naturally overtakes it over time.