Permalink
Browse files

IOS: Fix Arrow Key Capture in TextInputHandler.

This should fix these working from external keyboards i.e. IPad Pro and
other sources as well.

This is presumably what the original author intended.
  • Loading branch information...
Michael Zinn authored and digitall committed Aug 16, 2018
1 parent 4865b02 commit 82e8bc43e60ce5908097d62be1b2fbb59c4679e8
Showing with 17 additions and 17 deletions.
  1. +17 −17 backends/platform/ios7/ios7_keyboard.mm
@@ -53,19 +53,6 @@ - (id)initWithKeyboard:(SoftKeyboard *)keyboard {
return self;
}

@end


@implementation SoftKeyboard

- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
inputDelegate = nil;
inputView = [[TextInputHandler alloc] initWithKeyboard:self];
inputView.delegate = self;
return self;
}

- (NSArray *)keyCommands {
UIKeyCommand *upArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputUpArrow modifierFlags: 0 action: @selector(upArrow:)];
UIKeyCommand *downArrow = [UIKeyCommand keyCommandWithInput: UIKeyInputDownArrow modifierFlags: 0 action: @selector(downArrow:)];
@@ -75,19 +62,32 @@ - (NSArray *)keyCommands {
}

- (void) upArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:273];
[softKeyboard handleKeyPress:273];
}

- (void) downArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:274];
[softKeyboard handleKeyPress:274];
}

- (void) leftArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:276];
[softKeyboard handleKeyPress:276];
}

- (void) rightArrow: (UIKeyCommand *) keyCommand {
[self handleKeyPress:275];
[softKeyboard handleKeyPress:275];
}

@end


@implementation SoftKeyboard

- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
inputDelegate = nil;
inputView = [[TextInputHandler alloc] initWithKeyboard:self];
inputView.delegate = self;
return self;
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

0 comments on commit 82e8bc4

Please sign in to comment.