I wanted to close a gap that felt wrong in real use: autocorrect only ever looked at the word being typed right now. If a typo had already landed in the text and you tapped back into it, the keyboard just sat there and wouldn’t re-check the word or offer the right spelling. An earlier pass had made tapping into a word safe so it no longer mangled it, but the part you actually expect, tap the broken word and get the fix, wasn’t there yet. So now when the cursor lands inside a finished word the keyboard adopts it: it works out where the word starts and ends and, since the original taps are long gone, recreates them by dropping one tap dead-center on each letter’s key, then runs the same autocorrect search it uses while typing. The correct spelling shows up in the bar and one tap swaps it in where the word sits, without disturbing the spaces or words around it, and you can also just backspace and retype and it re-checks live. It never changes the word on its own - tapping in only offers a fix -which keeps the rule the whole project lives by, never correct a word that was already fine, intact at zero false corrections. The tricky part was telling apart the two times the cursor moves - when I move it, since right after committing a word the system reports the cursor now sitting after it, versus when you tap somewhere new. Treating my own cursor updates as a fresh tap made the keyboard re-grab and re-offer the word it had just finished, in a loop. I fixed it by remembering exactly where I last put the cursor and only reacting when it turns up somewhere I didn’t put it. The other half was being conservative about which words to touch: only plain Russian words, never names, numbers, or anything with characters that don’t exist on the keyboard, and never a half-typed fragment.
Finally I was also able to fix a bug word-tearing. At first I had marked it done, but the exact thing that happens when you edit a word still broke. Type a word, press space, backspace into it, keep typing, and the keyboard treats the new letters as a separate new word and splits the old one in half. So I reproduced it on the emulator in the Settings search box, the field from the screenshots, and changed how typing into existing text works.
Now when you start typing with the cursor inside a word the keyboard adopts that whole word and edits it as one unit instead of starting a loose fragment beside it, and I gave it a cursor index within the word so an inserted or deleted letter lands where the cursor actually is instead of always at the end. What slowed me down was that clean scripted taps would not tear the word no matter what I tried, which is the same trap I have fell into earlier. The bug was never in the path I kept testing. It only shows up once space has committed the word, and my reproductions weren’t pressing space first.
Only after many many tries I was able to finally understand the logic of the bug. Space, then backspace, then type. With space, the word is committed text, so backspacing into it does plain deletes and the old code then composed only the new letter as its own fragment. Replacing that “cursor sits inside text” path with whole-word adoption fixed it, and false corrections stayed at zero the whole time since an adopted word is only ever offered, never swapped on its own.