Skip to content

Commit

Permalink
Merge pull request Codeux-Software#413 from foldericon/smarter_nick_c…
Browse files Browse the repository at this point in the history
…ompletion_squashed

Smarter nick completion squashed
  • Loading branch information
emsquared committed Sep 4, 2013
2 parents 54c18d8 + 153820e commit ba696f2
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions Classes/Library/TLONickCompletionStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ - (void)completeNick:(BOOL)forward
NSString *lowerCombinedCut = combinedCut.lowercaseString;

NSMutableArray *upperChoices = [NSMutableArray array];
NSMutableArray *lowerChoices;
NSMutableArray *lowerChoices = [NSMutableArray array];

if (commandMode) {
for (NSString *command in [TPCPreferences publicIRCCommandList]) {
Expand Down Expand Up @@ -372,11 +372,23 @@ - (void)completeNick:(BOOL)forward
[upperChoices safeAddObject:client.isupport.networkNameActual];
}

lowerChoices = [upperChoices mutableCopy];

/* Quick method for replacing the value of each array
object based on a provided selector. */
[lowerChoices performSelectorOnObjectValueAndReplace:@selector(lowercaseString)];
/* Quick method for replacing the value of each array
object based on a provided selector. */

NSArray *tempChoices = [upperChoices copy];
NSCharacterSet *nonAlpha = [NSCharacterSet characterSetWithCharactersInString:@"^[]-_`{}\\"];
[upperChoices removeAllObjects];
for (NSString *s in tempChoices) {
[upperChoices safeAddObject:s];
[lowerChoices safeAddObject:[s lowercaseString]];
NSString *stripped = [s stringByTrimmingCharactersInSet:nonAlpha];
if (stripped != s) {
[upperChoices safeAddObject:s];
[lowerChoices safeAddObject:[stripped lowercaseString]];
}
}


/* We will now get a list of matches to our backward cut. */
NSMutableArray *currentUpperChoices = [NSMutableArray array];
Expand Down

0 comments on commit ba696f2

Please sign in to comment.