Fix duplicated leading digit when picking a suggestion (#2611) - #2636
Open
maximilize wants to merge 1 commit into
Open
Fix duplicated leading digit when picking a suggestion (#2611)#2636maximilize wants to merge 1 commit into
maximilize wants to merge 1 commit into
Conversation
A word starting with a character that doesn't begin composition on its own (such as a digit) has its leading part committed immediately while only the rest of the word is composing. Picking a suggestion that includes the leading part then duplicated it, e.g. typing "2u2j" and picking "2u2j@addres.com" produced "22u2j@addres.com". Extend the composing region to cover the whole word before committing the picked suggestion, so it replaces the whole word instead of only the composing part.
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 #2611.
When a word starts with a character that doesn't begin composition on its own — such as a digit — that leading part is committed immediately while only the rest of the word is composing. Picking a suggestion that includes the leading part then duplicated it: typing
2u2j(with2u2j@addres.comas a personal-dictionary word) and picking2u2j@addres.comproduced22u2j@addres.com.onPickSuggestionManuallynow checks whether the picked word starts with the whole word before the cursor — the composing part plus any non-separator characters committed right before it — and, if so, extends the composing region to cover the whole word before committing. The picked word then replaces the whole word instead of only the composing part. The guard onstartsWithkeeps this from touching unrelated preceding text.Added two regression tests to
InputLogicTest(pickSuggestionForWordWithLeadingDigitandpickSuggestionForWordWithLeadingDigitPartiallyTyped).