Repository navigation
renderer: fix preedit range width - #12479
Merged
Merged
Conversation
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.
Related to #12466
Preedit.range()returns an inclusive range, but the end position was calculated asstart + w. For wide preedit text, this covers one extra cell.In Debug builds, Korean IME composition between existing Hangul characters can panic with:
index out of bounds: index 2, len 2I reproduced this reliably when there are two Hangul characters to the right of the cursor. For example, type
가나다, move the cursor between가and나, then start a new Korean IME composition. With the old range calculation, the renderer skips the first wide character plus the head cell of the next wide character, then resumes on that character's spacer tail.This changes the inclusive end to
start + (w - 1)and adds focused tests for narrow, wide, and right-edge preedit ranges.This does not fully fix the visual behavior reported in #12466. The adjacent character can still disappear during composition, so this PR only fixes the crash side of the problem.