mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Ensure that both self.text and self.selectedTextRange are updated before triggering textDidChange: or selectionDidChange: on the input delegate (which then re-computes positions). This prevents inconsistencies in selection vs text position/offset lookups triggered by didChange notifications. Ensure that rangeOfComposedCharacterSequenceAtIndex: is only ever called for index values > 0 && < self.text.length. This prevents such calls for position with index == self.text.length. Also reduces unnecessary textDidChange/selectionDidChange notifications: replaceRange:withText: and setMarkedText:selectedRange: are only ever called by UIKit and methods called by UIKit (insertText, deleteBackward), so notification is unnecessary.