Skip to content

Fix duplicated leading digit when picking a suggestion (#2611) - #2636

Open
maximilize wants to merge 1 commit into
HeliBorg:mainfrom
maximilize:fix/2611-leading-digit-suggestion
Open

Fix duplicated leading digit when picking a suggestion (#2611)#2636
maximilize wants to merge 1 commit into
HeliBorg:mainfrom
maximilize:fix/2611-leading-digit-suggestion

Conversation

@maximilize

Copy link
Copy Markdown

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 (with 2u2j@addres.com as a personal-dictionary word) and picking 2u2j@addres.com produced 22u2j@addres.com.

onPickSuggestionManually now 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 on startsWith keeps this from touching unrelated preceding text.

Added two regression tests to InputLogicTest (pickSuggestionForWordWithLeadingDigit and pickSuggestionForWordWithLeadingDigitPartiallyTyped).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] When pasting an email it pastes the wrong string

1 participant