Revision: 27445
          http://sourceforge.net/p/bibdesk/svn/27445
Author:   hofman
Date:     2022-05-20 14:50:44 +0000 (Fri, 20 May 2022)
Log Message:
-----------
Only copy attributes when we change the color

Modified Paths:
--------------
    trunk/bibdesk/BDSKComplexStringFormatter.m

Modified: trunk/bibdesk/BDSKComplexStringFormatter.m
===================================================================
--- trunk/bibdesk/BDSKComplexStringFormatter.m  2022-05-20 14:19:05 UTC (rev 
27444)
+++ trunk/bibdesk/BDSKComplexStringFormatter.m  2022-05-20 14:50:44 UTC (rev 
27445)
@@ -96,18 +96,19 @@
     if ([obj isComplex] == NO && [obj isInherited] == NO)
         return nil;
     
-    NSMutableDictionary *attrs = [[NSMutableDictionary alloc] 
initWithDictionary:defaultAttrs];
        NSColor *color = nil;
-    BOOL isSelected = [[attrs objectForKey:NSForegroundColorAttributeName] 
isEqual:[NSColor alternateSelectedControlTextColor]];
+    BOOL isSelected = [[defaultAttrs 
objectForKey:NSForegroundColorAttributeName] isEqual:[NSColor 
alternateSelectedControlTextColor]];
     if ([obj isComplex])
         color = [NSColor complexStringColorInherited:[obj isInherited] 
selected:isSelected];
     else if ([obj isInherited])
         color = [NSColor inheritedStringColorSelected:isSelected];
-       if (color)
+    if (color) {
+        NSMutableDictionary *attrs = [[[NSMutableDictionary alloc] 
initWithDictionary:defaultAttrs] autorelease];
         [attrs setObject:color forKey:NSForegroundColorAttributeName];
-    NSAttributedString *attStr = [[[NSAttributedString alloc] 
initWithString:[obj expandedString] attributes:attrs] autorelease];
-    [attrs release];
-       return attStr;
+        defaultAttrs = attrs;
+    }
+    
+    return [[[NSAttributedString alloc] initWithString:[obj expandedString] 
attributes:defaultAttrs] autorelease];
 }
 
 - (BOOL)getObjectValue:(id *)obj forString:(NSString *)aString 
errorDescription:(NSString **)error{

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to