Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP] Fix crash with CJK keyboard with emoji at end of text field (#42540) #42945

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

Jasguerrero
Copy link
Contributor

Cherry pick of #42540

…42540)

The `isRTLAtPosition` method had a bug, it used `NSInteger max = [_selectionRects count]` instead of `NSInteger max = [_selectionRects count] - 1`. But I realized we don't even need the function any more, it was used in a few places in previous iterations of flutter#36643, but in the only place remaining, we actually already have the selection rect and don't need to search for it by position.

Btw as an explanation of the crash, I guess there is some mismatch between code point and character count somewhere. UIKit was asking for `caretRectForPosition:2` when we only had 1 character. This could have only crashed when floating cursor selection was used, but actually when switching to CJK keyboard, UIKit turns out to use `caretRectForPosition` to calculate something about the composing rect.

Fixes flutter/flutter#128031
Copy link
Contributor

@XilaiZhang XilaiZhang left a comment

Choose a reason for hiding this comment

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

LGTM! Casey could maybe add Jesús to the list so that flutter bot approves the pr for Jesús.

images (1)

@Jasguerrero Jasguerrero added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2023
@auto-submit auto-submit bot merged commit d4e07a9 into flutter:flutter-3.12-candidate.2 Jun 20, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
3 participants