Fix autocorrect not being applied in the editor on Samsung devices - #1841
Open
joashrajin wants to merge 1 commit into
Open
Fix autocorrect not being applied in the editor on Samsung devices#1841joashrajin wants to merge 1 commit into
joashrajin wants to merge 1 commit into
Conversation
SamsungInputConnection.commitText() suppressed every spellcheck/autocorrect commit that carried a SuggestionSpan, in order to protect checklist (CheckableSpan) spans from being corrupted when the Samsung keyboard replaced editor content. On One UI 7/8 (e.g. Galaxy S25, Android 16) this fires on ordinary prose too, so autocorrect-on-space is never applied and typos "stick" instead of being corrected. The bug it originally guarded against was tied to the in-keyboard Grammarly plugin that Samsung removed in 2024. Only take the protective path when the edited region (the composing region, or the selection when there is none) actually contains a CheckableSpan; otherwise forward to the keyboard's normal commit so autocorrect works. Checklist protection is unchanged where it is actually needed.
Collaborator
|
📲 You can test the changes from this Pull Request in Simplenote Android by scanning the QR code below to install the corresponding build.
|
Contributor
Author
|
How it works now with the fix: Screen_Recording_20260629_194056_Simplenote.mp4 |
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.
Supersedes #1840 — moved from a fork branch to an in-repo branch so Buildkite CI (Build and Test, Lint, Prototype Build) can run.
Fix
On Samsung devices the note editor installs a custom
SamsungInputConnection(gated onmanufacturer == samsung && SDK_INT >= 33 && keyboard startsWith com.samsung.android.honeyboard). ItscommitText()override swallows every spellcheck/autocorrect commit that carries aSuggestionSpan— copying the spans onto the existing text instead of letting the keyboard replace it. That workaround was added in early 2023 (ec90ef2, 42ca1bc) to stop the in-keyboard Grammarly component on One UI 5.0 / Android 13 from corrupting checklist (CheckableSpan) spans and the cursor.Video of the issue:
1000181860.mp4
The gate has no upper bound, so it still activates on One UI 7/8 (e.g. Galaxy S25, Android 16). There it fires on ordinary prose too, which means autocorrect-on-space is never applied and typos "stick" instead of being corrected. Samsung removed the in-keyboard Grammarly plugin in 2024 (One UI 7+ moved spell/grammar to keyboard-agnostic Galaxy AI Writing Assist), so the original trigger no longer exists — but the interception keeps degrading normal typing.
This change scopes the protective path to where it's actually needed:
commitText()only takes the span-copy branch when the edited region (the composing region, or the selection when there is none) actually contains aCheckableSpan. Otherwise it forwards to the keyboard's normal commit, restoring standard autocorrect/suggestions. Checklist protection is unchanged where checklists are being edited.Confirmed on a Galaxy S25 Ultra (SM-S938B, Android 16) via the in-app log (Settings → Send logs):
Detected spellchecker trying to commit partial text with suggestionsfired twice while typing plain prose with no checkboxes in the note — i.e. the old code was suppressing autocorrect with nothing to protect.Test
Requires a Samsung device on Android 13+ with the Samsung (Honeyboard) keyboard as default. Galaxy S25 / One UI 7-8 reproduces the original bug best.
Autocorrect now works (the fix):
tehorrecieve.the,receive) just like in other apps. (Before this change the typo stayed as typed.)Detected spellchecker trying to commit partial text with suggestionsshould not appear for this plain-text editing.Checklist protection still works (no regression):
- [ ]markdown), and the log line does appear for that line.Also worth a quick smoke test on a non-Samsung device (or Samsung + Gboard) to confirm unchanged behavior — those configs never use
SamsungInputConnection.Review
One developer review is sufficient. The change is isolated to
SamsungInputConnection.commitText()plus a new private helpereditedRegionHasCheckableSpan(). Key thing to sanity-check: the region used for theCheckableSpanlookup (composing region, falling back to selection, clamped/normalized) matches the region the framework would replace. On-device verification on a modern Samsung phone is the real proof, since this is IME-timing-sensitive code that can't be fully covered by unit tests.Release
RELEASE-NOTES.txtwas updated with:(Added to the top
2.38section to follow the existing convention — feel free to move it to the appropriate in-development version section if 2.38 is already cut.)