Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Skips auto-completion text processing if no prefix have been register…
Browse files Browse the repository at this point in the history
…ed. This is a regression bug.

Also makes -shouldProcessTextForAutoCompletion: require super from now on.
Fixes #438
  • Loading branch information
Ignacio Romero Zurbuchen committed Apr 18, 2016
1 parent 4c6e3ef commit fb2ad40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Source/SLKTextViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,14 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
- (void)registerPrefixesForAutoCompletion:(NSArray *_Nullable)prefixes;

/**
Verifies that controller is allowed to process the textView's text for auto-completion. Default is YES.
This is useful to disable momentarily the auto-completion feature, or to let it visible for longer time.
Verifies that controller is allowed to process the textView's text for auto-completion.
You can override this method to disable momentarily the auto-completion feature, or to let it visible for longer time.
You SHOULD call super to inherit some conditionals.
@param text The textView's current text.
@return YES if the controller is allowed to process the text for auto-completion.
*/
- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text;
- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text NS_REQUIRES_SUPER;

/**
Notifies the view controller either the autocompletion prefix or word have changed.
Expand Down
5 changes: 4 additions & 1 deletion Source/SLKTextViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,10 @@ - (void)registerPrefixesForAutoCompletion:(NSArray *)prefixes

- (BOOL)shouldProcessTextForAutoCompletion:(NSString *)text
{
// Always return YES by default.
if (!_registeredPrefixes || _registeredPrefixes.count == 0) {
return NO;
}

return YES;
}

Expand Down

0 comments on commit fb2ad40

Please sign in to comment.