Update marked text before selection so textInRange is never called with (flutter/engine#6989)
invalid input
This commit is contained in:
committed by
GitHub
parent
99b47761ce
commit
4e82db460b
@@ -216,6 +216,14 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
|
||||
[self.text setString:newText];
|
||||
}
|
||||
|
||||
NSInteger composingBase = [state[@"composingBase"] intValue];
|
||||
NSInteger composingExtent = [state[@"composingExtent"] intValue];
|
||||
NSRange composingRange = [self clampSelection:NSMakeRange(MIN(composingBase, composingExtent),
|
||||
ABS(composingBase - composingExtent))
|
||||
forText:self.text];
|
||||
self.markedTextRange =
|
||||
composingRange.length > 0 ? [FlutterTextRange rangeWithNSRange:composingRange] : nil;
|
||||
|
||||
NSInteger selectionBase = [state[@"selectionBase"] intValue];
|
||||
NSInteger selectionExtent = [state[@"selectionExtent"] intValue];
|
||||
NSRange selectedRange = [self clampSelection:NSMakeRange(MIN(selectionBase, selectionExtent),
|
||||
@@ -233,14 +241,6 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
|
||||
[self.inputDelegate selectionDidChange:self];
|
||||
}
|
||||
|
||||
NSInteger composingBase = [state[@"composingBase"] intValue];
|
||||
NSInteger composingExtent = [state[@"composingExtent"] intValue];
|
||||
NSRange composingRange = [self clampSelection:NSMakeRange(MIN(composingBase, composingExtent),
|
||||
ABS(composingBase - composingExtent))
|
||||
forText:self.text];
|
||||
self.markedTextRange =
|
||||
composingRange.length > 0 ? [FlutterTextRange rangeWithNSRange:composingRange] : nil;
|
||||
|
||||
if (textChanged) {
|
||||
[self.inputDelegate textDidChange:self];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user