Created
April 15, 2014 05:36
-
-
Save ivan3bx/2f168df23c91399aa884 to your computer and use it in GitHub Desktop.
Just a snippet of code for detecting a possible match. This seems inefficient for just single-character matches..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)textDidChange:(NSNotification *)aNotification | |
{ | |
NSTextView *textView = self.detailTextView; | |
NSString *contents = textView.textStorage.string; | |
NSRange selectionRange = textView.selectedRange; | |
if (selectionRange.length == 0 && contents.length > 0) { | |
NSString *possibleMatch = [contents substringWithRange:NSMakeRange(selectionRange.location - 1, 1)]; | |
if ([possibleMatch isEqualToString:@"{"]) { | |
[textView complete:nil]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment