-
Notifications
You must be signed in to change notification settings - Fork 6k
[iOS] text input methods to only call updateEditState once #19161
[iOS] text input methods to only call updateEditState once #19161
Conversation
gaaclarke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, modulo the naming problems.
| } | ||
|
|
||
| - (void)setSelectedTextRange:(UITextRange*)selectedTextRange updateEditingState:(BOOL)update { | ||
| - (void)_setSelectedTextRange:(UITextRange*)selectedTextRange { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In objc we don't prefix method names with _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to setSelectedTextRangeLocal
|
|
||
| - (void)replaceRange:(UITextRange*)range withText:(NSString*)text { | ||
| NSRange replaceRange = ((FlutterTextRange*)range).range; | ||
| - (void)_replaceRange:(NSRange)range withText:(NSString*)text { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here with _replaceRange:
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Great overall improvement, I feel like this could have been causing other subtle problems as well.
| FlutterTextInputPlugin* textInputPlugin; | ||
| } | ||
|
|
||
| - (void)setUp { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup 👍
Description
Make sure iOS text plugin only makes one
updateEditStatecall at the end of everyUITextInputmethod that changes the state of the text.setMarkedText: selectedRange:currently updates twice when it gets called, and the first call reports an inconsistent state, breaking the interaction with the iOS Kana IME.Related Issues
Fixes flutter/flutter#59734
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.