Skip to content

fix(web): fix construction for suggestions emitted after left-deleting whitespace 🚂 - #16307

Merged
jahorton merged 3 commits into
epic/autocorrectfrom
fix/web/suggestions-after-whitespace-leftdelete
Aug 6, 2026
Merged

fix(web): fix construction for suggestions emitted after left-deleting whitespace 🚂#16307
jahorton merged 3 commits into
epic/autocorrectfrom
fix/web/suggestions-after-whitespace-leftdelete

Conversation

@jahorton

@jahorton jahorton commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Also adds unit tests to cover the most substantially affected method. That method also had its parameter tweaked to better reflect the data it actually needs, which simplifies what must be provided for unit tests.

Build-bot: skip release:web release:android

User Testing

Use Keyman for Android for the following user tests.

TEST_ROBUSTNESS: Spend at least 5 minutes trying to "break" predictive text and/or cause it to work improperly while using sil_euro_latin and gff_amharic. Report back on any issues discovered.

TEST_REPRO_1: Attempt to reproduce the error-case reported in a user test on #16223:

  1. Using the gff_amharic keyboard
  2. Clear any pre-existing context
  3. Apply the left-most suggestion; it should be ላይ
  4. Type ውስጥል (Positionally, QWERTY xskl.)
  5. Tap to apply the highlighted suggestion
  6. Type q (result: )
  7. Backspace over q
  8. At this step, the typed text should look like ላይ ውስጥም
  9. The left-most word suggestion should be the reversion appearing as "ውስጥል" + other suggestions
  10. Do not apply the reversion, instead apply the second-left-most unhighlighted suggestion; it should be ፅኑ
  11. ISSUE: At this step, the typed text should look like ላይ ውስጥምፅኑ (no space between ውስጥም & ፅኑ)
  12. EXPECTED: Shouldn't the text result be ላይ ውስጥም ፅኑ (a space between ውስጥም & ፅኑ)?
Screen.Recording.2026-08-04.at.11.51.21.in.the.morning.mov

TEST_REPRO_2: Attempt to reproduce the error-case reported in a user test on #16223 (using gff_amharic):

  1. Clear any pre-existing context (In the video, I did not)
  2. Type ውስጥል (Positionally, QWERTY xskl.)
  3. Tap the highlighted suggestion
  4. Apply one of the default suggestion; it should be ላይ
  5. At this step, the typed text should look like ውስጥም ላይ
  6. Type f
  7. Notice that the typed key on the keyboard is still highlighted/pressed down because of the different colors
  8. Backspace until the cursor have reached the whitespace after the ውስጥም
  9. ISSUE: No reversion.
  10. Backspace once more for the cursor to land after the word ውስጥም
  11. ISSUE: The suggestion word is ውስጥም instead of ውስጥል
  12. EXPECTED: The reversion ውስጥል should display for this.
Screen.Recording.2026-08-04.at.11.51.57.in.the.morning.mov

…g whitespace

Build-bot: skip release:web release:android
@jahorton
jahorton requested a review from ermshiperete August 5, 2026 16:07
@github-project-automation github-project-automation Bot moved this to Todo in Keyman Aug 5, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added has-user-test user-test-required User tests have not been completed labels Aug 5, 2026
@keymanapp-test-bot

keymanapp-test-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot Bot changed the title fix(web): fix construction for suggestions emitted after left-deleting whitespace fix(web): fix construction for suggestions emitted after left-deleting whitespace 🚂 Aug 5, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S35 milestone Aug 5, 2026
@github-actions github-actions Bot added the fix label Aug 5, 2026
@Meng-Heng

Copy link
Copy Markdown
Contributor

Test Specs

  1. Keyman for Android v19.0.259-alpha-test-16307
  2. Android Studio: Emulator Piel 9a API 37

Test Results

  • TEST_ROBUSTNESS (PASSED):
  1. Clear any pre-existing context
  2. Using the sil_euro_latin keyboard
  3. Try producing errors by using backspace, tap, space to apply and delete the applied suggested words
  4. Using the gff_amharic keyboard
  5. Try doing the same as the step 3
  6. VERIFIED: The predictive text does not crash or produce any noticeable errors.
  • TEST_REPRO_1 (PASSED):
  1. Using the gff_amharic keyboard
  2. Clear any pre-existing context
  3. Apply the left-most suggestion which isላይ
  4. Type ውስጥል (Positionally, QWERTY xskl.)
  5. Tap to apply the highlighted suggestion
  6. Type q (result: ፅ)
  7. Backspace over q
  8. Text result: ላይ ውስጥም
  9. VERIFIED: The reversion is "ውስጥል" + other suggestions
  10. Do not apply the reversion, instead apply the second-left-most unhighlighted suggestion which is ላይ
  11. VERIFIED: The text result is ላይ ውስጥም ላይ
  12. Alternatively, applying the reversion does work as expected.
  • TEST_REPRO_2 (PASSED):
  1. Using the gff_amharic keyboard
  2. Clear any pre-existing context
  3. Type ውስጥል(Positionally, QWERTY xskl.)
  4. Tap the highlighted suggestion
  5. Apply one of the default suggestion which is ላይ
  6. Text result is ውስጥም ላይ
  7. Type f
  8. Backspace until the cursor have reached the whitespace after the ውስጥም
  9. VERIFIED: The appropriate reversion shows up as the word suggestion + other suggestions.
  10. Backspace once more for the cursor to land after the word ውስጥም
  11. VERIFIED: The suggestion word "ውስጥል" + ውስጥም

@keymanapp-test-bot keymanapp-test-bot Bot removed the user-test-required User tests have not been completed label Aug 6, 2026
Comment on lines +1284 to +1286
// Erasing a single-char whitespace requires deletion of two tokens, the
// last of which is empty. Check for this case and handle it accordingly
// as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this comment. Does it explain the if (!penultimateTransform) ? In that case it would be better if it would come before the break; line. Or does it refer to the next if?

@jahorton
jahorton enabled auto-merge August 6, 2026 18:58
@jahorton
jahorton disabled auto-merge August 6, 2026 18:58
@jahorton
jahorton enabled auto-merge August 6, 2026 18:59
@jahorton
jahorton changed the base branch from epic/autocorrect to master August 6, 2026 19:16
@jahorton
jahorton changed the base branch from master to epic/autocorrect August 6, 2026 19:17
@jahorton
jahorton merged commit d201171 into epic/autocorrect Aug 6, 2026
7 of 8 checks passed
@jahorton
jahorton deleted the fix/web/suggestions-after-whitespace-leftdelete branch August 6, 2026 21:53
@github-project-automation github-project-automation Bot moved this from Todo to Done in Keyman Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants