adium 3595:d5e33349b8cb: Refs #14285. Blocks "system-standard" w...
commits at adium.im
commits at adium.im
Sun Dec 5 10:42:30 UTC 2010
details: http://hg.adium.im/adium/rev/d5e33349b8cb
revision: 3595:d5e33349b8cb
author: Robby Weinberg <wildwobby at wildwobby.com>
date: Sun Dec 05 02:35:34 2010 -0800
Refs #14285. Blocks "system-standard" way of autocompletion (#1769). Sorts suggestions by length (#12746) and sets up basis to display multiple suggestions (#105777)
diffs (111 lines):
diff -r dccc0a064deb -r d5e33349b8cb Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj Sat Dec 04 13:54:10 2010 +0100
+++ b/Adium.xcodeproj/project.pbxproj Sun Dec 05 02:35:34 2010 -0800
@@ -9585,6 +9585,7 @@
};
buildConfigurationList = DADE8E3A085507450062B664 /* Build configuration list for PBXProject "Adium" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
diff -r dccc0a064deb -r d5e33349b8cb Frameworks/AIUtilities Framework/Source/AICompletingTextField.m
--- a/Frameworks/AIUtilities Framework/Source/AICompletingTextField.m Sat Dec 04 13:54:10 2010 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AICompletingTextField.m Sun Dec 05 02:35:34 2010 -0800
@@ -193,10 +193,11 @@
//Returns the known completion for a string segment
- (NSString *)completionForString:(NSString *)inString
{
+ NSMutableArray *possibleCompletions = [[NSMutableArray alloc] init];
NSEnumerator *enumerator;
NSString *compString = inString;
NSString *autoString;
- NSUInteger length;
+ NSUInteger length;
NSRange range;
// Find only the last item in the list, if we are to autocomplete only after separators
@@ -210,16 +211,26 @@
range = NSMakeRange(0, length);
if (length >= minLength) {
- //Check each auto-complete string for a match
+ //Check each auto-complete string for a match, add each match to array of possible competions
enumerator = [stringSet objectEnumerator];
while ((autoString = [enumerator nextObject])) {
if (([autoString length] > length) && [autoString compare:compString options:NSCaseInsensitiveSearch range:range] == 0) {
- return autoString;
+ [possibleCompletions addObject:autoString];
}
}
}
+
+ NSArray *sortedArray = [possibleCompletions sortedArrayUsingSelector:@selector(compareLength:)];
- return nil;
+ [possibleCompletions release];
+
+ if ([sortedArray count] > 0){
+ return [sortedArray objectAtIndex:0];
+ //When the AICompletingTextfield is modified to be able to provide multiple choices of completions, the entire array can be used later.
+ //return sortedArray;
+ }
+
+ return nil;
}
- (id)impliedValueForString:(NSString *)aString
diff -r dccc0a064deb -r d5e33349b8cb Frameworks/AIUtilities Framework/Source/AIStringAdditions.h
--- a/Frameworks/AIUtilities Framework/Source/AIStringAdditions.h Sat Dec 04 13:54:10 2010 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIStringAdditions.h Sun Dec 05 02:35:34 2010 -0800
@@ -131,6 +131,8 @@
- (BOOL) isCaseInsensitivelyEqualToString:(NSString *)other;
+- (NSComparisonResult)compareLength:(NSString *)aString;
+
- (unsigned long long)unsignedLongLongValue;
@end
diff -r dccc0a064deb -r d5e33349b8cb Frameworks/AIUtilities Framework/Source/AIStringAdditions.m
--- a/Frameworks/AIUtilities Framework/Source/AIStringAdditions.m Sat Dec 04 13:54:10 2010 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIStringAdditions.m Sun Dec 05 02:35:34 2010 -0800
@@ -865,6 +865,20 @@
return [self caseInsensitiveCompare:other] == NSOrderedSame;
}
+/*
+ * @brief For AICompletingTextField
+ */
+- (NSComparisonResult)compareLength:(NSString *)aText
+{
+ if ([aText length] > [self length]) {
+ return NSOrderedAscending;
+ } else if ([aText length] == [self length]) {
+ return NSOrderedSame;
+ } else {
+ return NSOrderedDescending;
+ }
+}
+
- (unsigned long long)unsignedLongLongValue
{
return [[NSDecimalNumber decimalNumberWithString:self] unsignedLongLongValue];
diff -r dccc0a064deb -r d5e33349b8cb Source/AINewMessagePromptController.m
--- a/Source/AINewMessagePromptController.m Sat Dec 04 13:54:10 2010 +0100
+++ b/Source/AINewMessagePromptController.m Sun Dec 05 02:35:34 2010 -0800
@@ -73,6 +73,14 @@
}
/*!
+ * @brief Suppress system autocompletion
+ */
+- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)indexa
+{
+ return nil;
+}
+
+/*!
* @brief Open a chat with the desired contact
*/
- (IBAction)okay:(id)sender
More information about the commits
mailing list