fix(two-thumb): clear stale merged-trail extend-base on delete + gesture lifecycle#61
Merged
Merged
Conversation
release: LeanTypeDual v3.8.5
…ure lifecycle WordComposer.mExtendBatchInputBase (the multi-part merged-trail base) was only cleared by a normally-completing gesture, so an abnormal end (cancel / empty-top recognition) left it armed, and no deletion path cleared it. A later fresh swipe then merged with the ghost trail - most visibly at the start of a text box. Clear it at the same word-end sites where mLiveStroke is already dropped (handleBackspaceEvent, resetComposingState, commitChosenWord, desync) plus the two gesture-lifecycle origins (onStartBatchInput top, onCancelBatchInput). Does not touch the hot WordComposer.reset() path. Adds 8 tests: base cleared after each backspace mode (character/fragment/whole-word), the delete slider, fresh onStartBatchInput, and onCancelBatchInput; plus 2 guards pinning the (currently dead) static-seed interlock. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Owner
|
On-device verified (S24+, standard debug build) alongside the rest of the integration branch: fresh swipe after delete no longer fuses with the deleted gesture's trail. ✅ |
This was referenced Jun 7, 2026
This was referenced Jun 9, 2026
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.
Fixes #60.
What
WordComposer.mExtendBatchInputBase(the multi-part merged-trail base) was only cleared by a normally-completing gesture, so an abnormal gesture end (cancel / empty-top recognition) left it armed — and no deletion path cleared it. A later fresh swipe then merged with the stale "ghost" trail, most visibly at the start of a text box (where no composing word exists to re-set the base). Full root-cause writeup in #60.Change
Clear
mExtendBatchInputBaseat the same word-end sites wheremLiveStrokeis already dropped, plus the two gesture-lifecycle origins:onStartBatchInput(top, before the extend decision — guarantees every gesture starts from a clean base; the extend branch re-arms it from the real composing word when appropriate)onCancelBatchInput(a cancelled gesture never reaches the routine clear)handleBackspaceEvent(next to the existingmLiveStroke.reset(), before any mode branch — covers all three backspace modes in one place)resetComposingState(covers the delete slider'sfinishInputand cursor-move resets)commitChosenWordand the composing-desync recovery pathDeliberately not added to the hot
WordComposer.reset()path — mirroring the already-reviewedmLiveStrokeclearing is equivalent and avoids any interaction with the mid-gesture merge timing.Tests
8 new JVM tests in
InputLogicTest.kt:finishInput)onStartBatchInputonCancelBatchInputgrace > 0 ⇒ isMultipartComposeActive()), so a future settings refactor can't silently re-arm that path without adding the missing stale-static cleanup:app:testStandardDebugUnitTest(the 8 new tests +WordComposerTest): green.:app:assembleStandardDebug: builds. (The 3 pre-existing known-failing tests —insertLetterIntoWordHangulFails,revert autocorrect on delete,tapOnlyCombiningWordDoesNotShowAutospaceIndicator…— are unrelated.)Manual test plan
Notes
mExtendBatchInputBasemutation runs on the UI thread (the recognizer runs on the suggestionsHandlerThreadbut only reads a snapshot), so these clears need no locking and can't race the merge.WordComposer.mInputPointers; and the text-expander early-returns incommitChosenWordskip the trail clears for expanded shortcut words.🤖 Generated with Claude Code