From ffe1d3fca6199594535967cf9c05fb4a7ee7cc27 Mon Sep 17 00:00:00 2001 From: Gary Qian Date: Fri, 22 Nov 2019 14:02:50 -0800 Subject: [PATCH] Do not default to downstream affinity on iOS insertText (flutter/engine#13852) --- .../darwin/ios/framework/Source/FlutterTextInputPlugin.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index ad39e710eeb..f22fb51b42d 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -621,7 +621,9 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) { } - (void)insertText:(NSString*)text { - _selectionAffinity = _kTextAffinityDownstream; + // The affinity is unknown here. Set to "" so that Flutter interprets it + // as ambiguous and uses a fallback affinity. + _selectionAffinity = ""; [self replaceRange:_selectedTextRange withText:text]; }