Repository navigation
fix(ime): iOS 2.1 typing fixes behind a debug switch (held letter, two thumbs, Return vs apostrophe) - #448
Merged
Conversation
Behind debug_ios_typing_fixes, off by default and read in debuggable builds only: - a letter key's gesture starts only when its own finger lands, so an overlapping roll no longer types a letter twice (errt for e r t); - a held letter whose accents opened is typed while the finger stays on its own key (a drift no longer types the accent above it); - a Return tap under the apostrophe's column, in the top quarter row pitch, types the apostrophe after a French elision (iOS #1099). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Closes #443
Touches letter-key touch handling: Pierre must test it on the Pixel before merge (steps below). Everything is behind a debug switch, off by default: with it off, the keyboard runs develop's code paths unchanged.
What this was for
iOS 2.1 shipped three typing fixes (getdictus/dictus-ios#1097, #1098, #1099). #443 asks for a check of each one on Android, and a fix only where Android has the same defect. Android has a defect on all three points, though not always the one iOS had:
onPressAtDown, #422/#426). But once the strip is open, any drift of 8 dp picks an accent by x alone, and the Frenchestrip (é è ê ë ę ė ē) is centred on the key. So a heldereleased a little lower typesëACTION_POINTER_DOWNreaches every held key as aPress. An overlapping roll one r ttypeserrtchangedToDown), as the space bar's already does.e r trolled typesert'(units 7.5 to 8.5 of row 3) sits over the left end of Return (8.0 to 10.0), the 4 dp gap is split at its middle (#400), and there is no context ruleApostropheReturnBorder, ported: a tap in the top 0.25 row pitch of Return's touch area, under the apostrophe's column, types the apostrophe when the word before the cursor isc d j l m n s t quor ends inquTo test by hand (Pierre, Pixel 4)
Build of this PR's head, debug build. Turn the switch on, then show the keyboard again (the script stops the app):
Type in any text field with the Dictus keyboard (French AZERTY).
euntil the accents show, roll your thumb a little downward, lift. Expected:e. Switch off, same gesture:ë(develop's behaviour).e, slide up ontoéand lift:é. Holde, slide left along the key row and lift: the accent under the finger (èoré).errt).c, then tap low on the apostrophe, close to Return:c'and no new line. Same afterl,qu,jusqu.bonjour, tap the top-left of Return: a new line. Typec, tap the middle of Return: a new line.Turn the switch off afterwards with
... set --bool debug_ios_typing_fixes false.The switch
PreferenceKeys.DEBUG_IOS_TYPING_FIXES(debug_ios_typing_fixes), the same pattern asdebug_spatial_autocorrect(#385): it is read in debuggable builds only, no settings screen shows it, and it is off when unset.DictusImeServiceprovides it to the keys asLocalIosTypingFixes(the two letter-key fixes) andLocalApostropheReturnTaps(the border; null when off). With the switch off,KeyButtontakes develop's branches: the first change of thePressfor the down position, no own-key test, no redirect.Changes
ime/ui/ApostropheReturnBorder.kt(new):ApostropheReturnBorder, the pure rule ported fromDictusCore/ApostropheReturnBorder.swift(same reach, same word list, the text read only inside the band).ApostropheReturnTapsis where the adaptive key registers its touch area while it shows'; Return asks it on each tap. After a vowel the adaptive key shows an accent, unregisters, and Return stays Return, as on iOS.ime/ui/KeyButton.kt, the letter/other-key gesture: the own-finger landing check, the own-key test in the accent tracking, and the Return redirect at tap time (the touch-down point, as iOS's first point).ime/DictusImeService.kt: the switch, and the 8 characters before the cursor for the border.core/.../PreferenceKeys.kt: the key.typing.accents(held letter) and the switch gotcha intyping.autocorrect.md, and the border plus the two thumbs underkeyboard.layoutinkeyboard.languages.md. No new ID. iOS #1098 added none, and no screen changes.Tests
New (Robolectric unless noted, French AZERTY, the whole
KeyboardScreen):HeldLetterReleaseTest(6): held past the strip and released in place, 0.3 row lower or two rows lower →e. Switch off, 0.3 row lower →ë. Sliding up onto the strip →ë, along the row →è.TwoThumbRollTest(6):e r toverlapping →ert(off:errt); « une tres belle terre » rolled; the second thumb lifting first →er; the first thumb trembling while the second is down →ert; one finger « bonjour ».ApostropheReturnBorderTest(9, plain JVM): iOS's tests on Android's grid (Pixel 4, 393 dp, rows of 53 dp). Pierre's two iOS taps (TJ TAPIntegrate native trie behind the IME suggestion contract #69, feat(trie): add hardened n-gram contract #74) land on Return's touch area under the apostrophe's column, and type'afterc,C,Oui, cbut Return afterbonjour, `` (empty),c, `c'`, `x`. Return's centre and the point below the band stay Return, so does the zone under ⌫, and the apostrophe's centre stays the apostrophe. The word list and the « no text read outside the band » check are covered, and no word of the bench corpus turns a Return into an apostrophe.ApostropheReturnTapUiTest(4): a real tap 2 px under Return's top, under the apostrophe, gives'aftercand Return afterbonjour. Return's middle gives Return, and so does the same tap with the switch off.No word broken: before and after on the same corpus
TwoThumbCorpusTesttypes the keyboard bench's 40 sentences (tools/keyboard-bench/corpus/{fr,en}.txt, accents dropped: the letter page has no key for them) through the real keyboard, switch off and then on, two ways: one tap after another, as the bench replays them, and as an overlapping roll.Taps: identical texts with the switch off and on. Roll: develop doubles almost every letter (
jee ssuuiiss eenn rreettaarrdd…), and the switch types every sentence as meant.Why unit tests and not a run of the emulator bench (
tools/keyboard-bench/run.sh): its replay injects one touch at a time (down, up 40 ms later, about 170 ms between taps) and contains no Return. None of the three changes can act on it. Switch on, a press that starts with its own finger behaves as before, an accent is never opened (no press lasts 400 ms), and the border needs a Return tap. The corpus test above replays the same sentences through the real Compose hit test, and also covers the overlapping case the bench cannot inject.Local
./gradlew :core:testDebugUnitTest :ime:testDebugUnitTest :app:testDebugUnitTest lint assembleDebug: exit code 0 (core 289, ime 863, app 711 tests, 0 failures; lint and assembleDebug green).Decision left open: iOS's cancel zone (#1097)
iOS 2.1, as Apple's keyboard does, types nothing when a held letter is released at least half a key below the key. Android has never had a way to cancel a held letter, and this PR does not add one: with the switch on, a release two rows down still types the letter. Recommendation: do not port it. On Android it would be a new way to lose a letter, for a thumb that drifts down, which is the complaint #1097 answered. If you want parity with iOS, it is a few lines in the same tracking loop.
Risks
ëdefect.c d j l m n s t qu…, a Return deliberately aimed at the top-left corner of the key types': the top 13 dp of Return's touch area (2 dp of gap, 11 dp of key), under the apostrophe's column only. The reach (0.25 row pitch) is iOS's, chosen there from two taps, not from a distribution.Found on the way, not changed
Releaseis the wholePOINTER_UPevent). That is develop's behaviour, and outside this brief.Evidence
Test reports and the corpus table are local, on Titus's machine:
/home/pierre/Dev/dictus-proofs/443/.🤖 Generated with Claude Code