adium-1.4 2572:0125c66cb28b: merging [fcdec413dac8] in adium for...
commits at adium.im
commits at adium.im
Wed Aug 12 02:29:14 UTC 2009
details: http://hg.adium.im/adium-1.4/rev/0125c66cb28b
revision: 2572:0125c66cb28b
author: Stephen Holt <sholt at adium.im>
date: Tue Aug 11 22:32:51 2009 -0400
merging [fcdec413dac8] in adium for adium-1.4
diffs (45 lines):
diff -r 75fb8ee8f2e6 -r 0125c66cb28b Source/AIEmoticonController.m
--- a/Source/AIEmoticonController.m Sat Aug 08 14:08:52 2009 -0500
+++ b/Source/AIEmoticonController.m Tue Aug 11 22:32:51 2009 -0400
@@ -276,19 +276,29 @@
/* If the emoticon would end the string except for whitespace, newlines, or punctionation at the end, or it begins the string after removing
* whitespace, newlines, or punctuation at the beginning, it is acceptable even if the previous conditions weren't met.
*/
- static NSCharacterSet *endingTrimSet = nil;
- if (!endingTrimSet) {
+ NSCharacterSet *endingTrimSet = nil;
+ static NSMutableDictionary *endingSetDict = nil;
+ if(!endingSetDict) {
+ endingSetDict = [[NSMutableDictionary alloc] initWithCapacity:10];
+ }
+ if (!(endingTrimSet = [endingSetDict objectForKey:replacementString])) {
NSMutableCharacterSet *tempSet = [[NSCharacterSet punctuationCharacterSet] mutableCopy];
[tempSet formUnionWithCharacterSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
- endingTrimSet = [tempSet immutableCopy];
+ [tempSet formUnionWithCharacterSet:[NSCharacterSet symbolCharacterSet]];
+ //remove any characters *in* the replacement string from the trimming set
+ [tempSet removeCharactersInString:replacementString];
+ [endingSetDict setObject:[tempSet immutableCopy] forKey:replacementString];
[tempSet release];
+ endingTrimSet = [endingSetDict objectForKey:replacementString];
}
NSString *trimmedString = [messageString stringByTrimmingCharactersInSet:endingTrimSet];
NSUInteger trimmedLength = [trimmedString length];
if (trimmedLength == (originalEmoticonLocation + textLength)) {
+ // Replace at end of string
acceptable = YES;
- } else if ((originalEmoticonLocation - (messageStringLength - trimmedLength)) == 0) {
+ } else if ([trimmedString characterAtIndex:0] == [replacementString characterAtIndex:0]) {
+ // Replace at start of string
acceptable = YES;
}
}
@@ -358,6 +368,7 @@
//Always increment the loop
if (currentLocationNeedsUpdate) {
*currentLocation += 1;
+ originalEmoticonLocation = *currentLocation;
}
[candidateEmoticons release];
More information about the commits
mailing list