@@ -2001,14 +2001,12 @@ - (UIKeyCommand *)slk_returnKeyCommand
20012001 UIKeyCommand *command = [UIKeyCommand keyCommandWithInput: @" \r " modifierFlags: 0 action: @selector (didPressReturnKey: )];
20022002
20032003#ifdef __IPHONE_9_0
2004- // Only available since iOS9
2005- if ([UIKeyCommand respondsToSelector: @selector (keyCommandWithInput:modifierFlags:action:discoverabilityTitle: )] ) {
2006- if (self.textInputbar .isEditing ) {
2007- command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Commit Editing" , nil );
2008- }
2009- else {
2010- command.discoverabilityTitle = [self .rightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Send" , nil );
2011- }
2004+ // Only available since iOS 9
2005+ if (self.textInputbar .isEditing ) {
2006+ command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Commit Editing" , nil );
2007+ }
2008+ else if (self.textView .text .length > 0 ) {
2009+ command.discoverabilityTitle = [self .rightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Send" , nil );
20122010 }
20132011#endif
20142012
@@ -2020,17 +2018,15 @@ - (UIKeyCommand *)slk_escKeyCommand
20202018 UIKeyCommand *command = [UIKeyCommand keyCommandWithInput: UIKeyInputEscape modifierFlags: 0 action: @selector (didPressEscapeKey: )];
20212019
20222020#ifdef __IPHONE_9_0
2023- // Only available since iOS9
2024- if ([UIKeyCommand respondsToSelector: @selector (keyCommandWithInput:modifierFlags:action:discoverabilityTitle: )] ) {
2025- if (self.isAutoCompleting ) {
2026- command.discoverabilityTitle = NSLocalizedString(@" Exit Auto-Completion" , nil );
2027- }
2028- else if (self.textInputbar .isEditing ) {
2029- command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Exit Editing" , nil );
2030- }
2031- else if (!self.isExternalKeyboardDetected && self.keyboardHC .constant != 0 ) {
2032- command.discoverabilityTitle = NSLocalizedString(@" Hide Keyboard" , nil );
2033- }
2021+ // Only available since iOS 9
2022+ if (self.isAutoCompleting ) {
2023+ command.discoverabilityTitle = NSLocalizedString(@" Exit Auto-Completion" , nil );
2024+ }
2025+ else if (self.textInputbar .isEditing ) {
2026+ command.discoverabilityTitle = [self .textInputbar.editorRightButton titleForState: UIControlStateNormal] ? : NSLocalizedString(@" Exit Editing" , nil );
2027+ }
2028+ else if (!self.isExternalKeyboardDetected && self.keyboardHC .constant != 0 ) {
2029+ command.discoverabilityTitle = NSLocalizedString(@" Hide Keyboard" , nil );
20342030 }
20352031#endif
20362032
@@ -2042,14 +2038,12 @@ - (UIKeyCommand *)slk_arrowKeyCommand:(NSString *)inputUpArrow
20422038 UIKeyCommand *command = [UIKeyCommand keyCommandWithInput: inputUpArrow modifierFlags: 0 action: @selector (didPressArrowKey: )];
20432039
20442040#ifdef __IPHONE_9_0
2045- // Only available since iOS9
2046- if ([UIKeyCommand respondsToSelector: @selector (keyCommandWithInput:modifierFlags:action:discoverabilityTitle: )] && self.textView .numberOfLines > 1 ) {
2047- if ([inputUpArrow isEqualToString: UIKeyInputUpArrow]) {
2048- command.discoverabilityTitle = NSLocalizedString(@" Move Up" , nil );
2049- }
2050- if ([inputUpArrow isEqualToString: UIKeyInputDownArrow]) {
2051- command.discoverabilityTitle = NSLocalizedString(@" Move Down" , nil );
2052- }
2041+ // Only available since iOS 9
2042+ if ([inputUpArrow isEqualToString: UIKeyInputUpArrow]) {
2043+ command.discoverabilityTitle = NSLocalizedString(@" Move Up" , nil );
2044+ }
2045+ if ([inputUpArrow isEqualToString: UIKeyInputDownArrow]) {
2046+ command.discoverabilityTitle = NSLocalizedString(@" Move Down" , nil );
20532047 }
20542048#endif
20552049
0 commit comments