adium-1.4 2668:51b737ca9b65: Only validate "Restore default form...

commits at adium.im commits at adium.im
Wed Oct 28 15:09:25 UTC 2009


details:	http://hg.adium.im/adium-1.4/rev/51b737ca9b65
revision:	2668:51b737ca9b65
author:		Zachary West <zacw at adium.im>
date:		Wed Oct 28 11:09:20 2009 -0400

Only validate "Restore default formatting" if the attributes our defaults specify are modified in the current typing attributes. There's a whole mess of other attributes that the NSTextView may have, very few of which are specified as defaults.

Refs #13154.

diffs (21 lines):

diff -r 3b3d1d6c5394 -r 51b737ca9b65 Source/AdiumFormatting.m
--- a/Source/AdiumFormatting.m	Wed Oct 28 10:49:09 2009 -0400
+++ b/Source/AdiumFormatting.m	Wed Oct 28 11:09:20 2009 -0400
@@ -128,8 +128,15 @@
 {
 	NSResponder *responder = [[NSApp mainWindow] firstResponder];
 
-	return (([responder isKindOfClass:[NSTextView class]]) &&
-			(![[(NSTextView *)responder typingAttributes] isEqualToDictionary:[self defaultFormattingAttributes]]));
+	if (![responder isKindOfClass:[NSTextView class]]) {
+		return NO;
+	}
+	
+	NSDictionary *defaultAttributes = [self defaultFormattingAttributes];
+	NSSet *defaultAttributeKeysSet = [NSSet setWithArray:[defaultAttributes allKeys]];
+	NSDictionary *typingAttributes = [[(NSTextView *)responder typingAttributes] dictionaryWithIntersectionWithSetOfKeys:defaultAttributeKeysSet];
+	
+	return (![typingAttributes isEqualToDictionary:defaultAttributes]);
 }
 
 @end




More information about the commits mailing list