forked from firka/flutter
[iOS] Hardware keyboard text editing shortcuts (flutter/engine#28971)
* [iOS] Hardware keyboard text editing shortcuts * Remove useless declarations
This commit is contained in:
@@ -896,6 +896,30 @@ static FlutterAutofillType autofillTypeOf(NSDictionary* configuration) {
|
||||
return _textInputClient != 0;
|
||||
}
|
||||
|
||||
#pragma mark - UIResponderStandardEditActions Overrides
|
||||
|
||||
- (void)cut:(id)sender {
|
||||
[UIPasteboard generalPasteboard].string = [self textInRange:_selectedTextRange];
|
||||
[self replaceRange:_selectedTextRange withText:@""];
|
||||
}
|
||||
|
||||
- (void)copy:(id)sender {
|
||||
[UIPasteboard generalPasteboard].string = [self textInRange:_selectedTextRange];
|
||||
}
|
||||
|
||||
- (void)paste:(id)sender {
|
||||
[self insertText:[UIPasteboard generalPasteboard].string];
|
||||
}
|
||||
|
||||
- (void)delete:(id)sender {
|
||||
[self replaceRange:_selectedTextRange withText:@""];
|
||||
}
|
||||
|
||||
- (void)selectAll:(id)sender {
|
||||
[self setSelectedTextRange:[self textRangeFromPosition:[self beginningOfDocument]
|
||||
toPosition:[self endOfDocument]]];
|
||||
}
|
||||
|
||||
#pragma mark - UITextInput Overrides
|
||||
|
||||
- (id<UITextInputTokenizer>)tokenizer {
|
||||
|
||||
@@ -247,6 +247,30 @@ FLUTTER_ASSERT_ARC
|
||||
XCTAssertEqual(substring.length, 0ul);
|
||||
}
|
||||
|
||||
- (void)testStandardEditActions {
|
||||
NSDictionary* config = self.mutableTemplateCopy;
|
||||
[self setClientId:123 configuration:config];
|
||||
NSArray<FlutterTextInputView*>* inputFields = self.installedInputViews;
|
||||
FlutterTextInputView* inputView = inputFields[0];
|
||||
|
||||
[inputView insertText:@"aaaa"];
|
||||
[inputView selectAll:nil];
|
||||
[inputView cut:nil];
|
||||
[inputView insertText:@"bbbb"];
|
||||
[inputView paste:nil];
|
||||
[inputView selectAll:nil];
|
||||
[inputView copy:nil];
|
||||
[inputView paste:nil];
|
||||
[inputView selectAll:nil];
|
||||
[inputView delete:nil];
|
||||
[inputView paste:nil];
|
||||
[inputView paste:nil];
|
||||
|
||||
UITextRange* range = [FlutterTextRange rangeWithNSRange:NSMakeRange(0, 30)];
|
||||
NSString* substring = [inputView textInRange:range];
|
||||
XCTAssertEqualObjects(substring, @"bbbbaaaabbbbaaaa");
|
||||
}
|
||||
|
||||
- (void)testNoZombies {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/62501.
|
||||
FlutterSecureTextInputView* passwordView = [[FlutterSecureTextInputView alloc] init];
|
||||
|
||||
Reference in New Issue
Block a user