adium 2798:fcfc13b945fc: When replacing an emoticon in an attrib...
commits at adium.im
commits at adium.im
Wed Oct 28 17:52:40 UTC 2009
details: http://hg.adium.im/adium/rev/fcfc13b945fc
revision: 2798:fcfc13b945fc
author: Zachary West <zacw at adium.im>
date: Wed Oct 28 13:50:22 2009 -0400
When replacing an emoticon in an attributed string, don't copy any previous attachments that string had into the replacement string. Fixes #12186.
diffs (19 lines):
diff -r 5dd8e46268e8 -r fcfc13b945fc Source/AIEmoticonController.m
--- a/Source/AIEmoticonController.m Wed Oct 28 11:09:20 2009 -0400
+++ b/Source/AIEmoticonController.m Wed Oct 28 13:50:22 2009 -0400
@@ -344,9 +344,13 @@
if (acceptable) {
replacement = [emoticon attributedStringWithTextEquivalent:replacementString attachImages:!isMessage];
+ NSDictionary *originalAttributes = [originalAttributedString attributesAtIndex:originalEmoticonLocation
+ effectiveRange:nil];
+
+ originalAttributes = [originalAttributes dictionaryWithDifferenceWithSetOfKeys:[NSSet setWithObject:NSAttachmentAttributeName]];
+
//grab the original attributes, to ensure that the background is not lost in a message consisting only of an emoticon
- [replacement addAttributes:[originalAttributedString attributesAtIndex:originalEmoticonLocation
- effectiveRange:nil]
+ [replacement addAttributes:originalAttributes
range:NSMakeRange(0,1)];
//insert the emoticon
More information about the commits
mailing list