Do not use fallback attributes when retrieving default values.

This commit is contained in:
Rustam Vishnyakov
2013-01-18 18:09:50 +04:00
parent c1ee6d7b18
commit 146751af49
2 changed files with 5 additions and 5 deletions
@@ -110,10 +110,6 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey>, J
*/
public TextAttributes getDefaultAttributes() {
if (myDefaultAttributes == NULL_ATTRIBUTES) {
if (myFallbackAttributeKey != null) {
TextAttributes fallbackAttributes = myFallbackAttributeKey.getDefaultAttributes();
if (fallbackAttributes != null && !fallbackAttributes.isEmpty()) return fallbackAttributes;
}
// E.g. if one text key reuse default attributes of some other predefined key
myDefaultAttributes = null;
final TextAttributeKeyDefaultsProvider provider = ourDefaultsProvider.getValue();
@@ -43,7 +43,11 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl
if (key == null) return null;
TextAttributes attrs = myAttributesMap.get(key);
if (attrs == null) {
attrs = key.getDefaultAttributes();
if (key.getFallbackAttributeKey() != null) {
attrs = getFallbackAttributes(key.getFallbackAttributeKey());
if (attrs != null && !attrs.isFallbackEnabled()) return attrs;
}
attrs = key.getDefaultAttributes();
}
return attrs;
}