This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit de68fba
authored
Fix crash with CJK keyboard with emoji at end of text field (#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 #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#1280311 parent e6f9712 commit de68fba
2 files changed
Lines changed: 29 additions & 22 deletions
File tree
- shell/platform/darwin/ios/framework/Source
Lines changed: 6 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1658 | 1658 | | |
1659 | 1659 | | |
1660 | 1660 | | |
1661 | | - | |
1662 | | - | |
1663 | | - | |
1664 | | - | |
1665 | | - | |
1666 | | - | |
1667 | | - | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
1671 | | - | |
1672 | | - | |
1673 | | - | |
1674 | | - | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | 1661 | | |
1681 | 1662 | | |
1682 | 1663 | | |
| |||
1699 | 1680 | | |
1700 | 1681 | | |
1701 | 1682 | | |
1702 | | - | |
| 1683 | + | |
| 1684 | + | |
1703 | 1685 | | |
1704 | 1686 | | |
1705 | 1687 | | |
| |||
1712 | 1694 | | |
1713 | 1695 | | |
1714 | 1696 | | |
1715 | | - | |
| 1697 | + | |
| 1698 | + | |
1716 | 1699 | | |
1717 | 1700 | | |
1718 | 1701 | | |
| |||
1727 | 1710 | | |
1728 | 1711 | | |
1729 | 1712 | | |
1730 | | - | |
| 1713 | + | |
| 1714 | + | |
1731 | 1715 | | |
1732 | 1716 | | |
1733 | 1717 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1558 | 1558 | | |
1559 | 1559 | | |
1560 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
1561 | 1584 | | |
1562 | 1585 | | |
1563 | 1586 | | |
| |||
0 commit comments