adium-1.4 2973:8820926dc460: Patch from mlei that corrects tab c...

commits at adium.im commits at adium.im
Tue May 18 22:07:08 UTC 2010


details:	http://hg.adium.im/adium-1.4/rev/8820926dc460
revision:	2973:8820926dc460
author:		Frank Dowsett <wixardy at adium.im>
date:		Tue May 18 18:03:43 2010 -0400

Patch from mlei that corrects tab completion in Twitter. Fixes #13981
(transplanted from cfa2703c4a3471b0c37e27b271a0107fee09556c)

diffs (33 lines):

diff -r f6954bdef95a -r 8820926dc460 Plugins/Dual Window Interface/AIMessageViewController.m
--- a/Plugins/Dual Window Interface/AIMessageViewController.m	Tue May 18 16:13:01 2010 -0500
+++ b/Plugins/Dual Window Interface/AIMessageViewController.m	Tue May 18 18:03:43 2010 -0400
@@ -1058,18 +1058,20 @@
 		completions = [NSMutableArray array];
 		
 		for (AIListContact *listContact in [self contactsMatchingBeginningString:partialWord]) {
-			// For each matching contact: if chatShouldAutoCompleteUID, then return the formattedUID
-			// else return the displayName
-			NSString *displayName = autoCompleteUID ? listContact.formattedUID : listContact.displayName;
+			// For each matching contact: if chatShouldAutoCompleteUID, then use the formattedUID
+			// else use the displayName
+			NSString *completion = autoCompleteUID ? listContact.formattedUID : listContact.displayName;
 			
-			// Check the alias. If it's the same as the UID or displayName except for case, use the alias
-			// (Since it probably is mixed case)
-			NSString *alias = [self.chat aliasForContact:listContact];
-			if ([alias caseInsensitiveCompare:displayName] == NSOrderedSame) {
-				displayName = alias;
+			// Check the displayNameForContact (either the alias or, if it doesn't exist, the displayName).
+			// If it is the same as the completion except for case, use it (makes it complete in pretty case).
+			// We must check to see if it exists before running a string comparison on it.
+			NSString *aliasOrDisplayName = [self.chat displayNameForContact:listContact];
+			if (aliasOrDisplayName && [aliasOrDisplayName caseInsensitiveCompare:completion] == NSOrderedSame) {
+				completion = aliasOrDisplayName;
 			}
 			
-			[completions addObject:(suffix ? [displayName stringByAppendingString:suffix] : displayName)];
+			// Add what we came up with to the completions list (with suffix if at beginning of line)
+			[completions addObject:(suffix ? [completion stringByAppendingString:suffix] : completion)];
 		}
 		
 		if ([self.chat.displayName rangeOfString:partialWord options:(NSDiacriticInsensitiveSearch | NSCaseInsensitiveSearch | NSAnchoredSearch)].location != NSNotFound) {




More information about the commits mailing list