diff --git a/shell/platform/darwin/macos/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/macos/framework/Source/FlutterTextInputPlugin.mm index 402534b6629ba5e06fc37e43d586796461ca3fe5..46af8dd3953b13d4497bd173cec2623f08dbbd13 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterTextInputPlugin.mm @@ -181,15 +181,14 @@ static NSString* const kMultilineInputType = @"TextInputType.multiline"; - (void)deleteBackward:(id)sender { NSRange selection = self.activeModel.selectedRange; - if (selection.location == 0) - return; NSRange range = selection; if (selection.length == 0) { + if (selection.location == 0) + return; NSUInteger location = (selection.location == NSNotFound) ? self.activeModel.text.length - 1 : selection.location - 1; range = NSMakeRange(location, 1); } - self.activeModel.selectedRange = NSMakeRange(range.location, 0); [self insertText:@"" replacementRange:range]; // Updates edit state }