diff --git a/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java b/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java index 8d356e5bea48..d1adc7bfcb83 100644 --- a/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java +++ b/platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java @@ -33,8 +33,9 @@ public class TextAttributes implements Cloneable { public static final TextAttributes ERASE_MARKER = new TextAttributes(); - private boolean myEnforcedDefaults; + private boolean myEnforceEmpty; + @SuppressWarnings("NullableProblems") @NotNull private AttributesFlyweight myAttrs; @@ -72,7 +73,7 @@ public class TextAttributes implements Cloneable { private TextAttributes(@NotNull AttributesFlyweight attributesFlyweight, boolean enforced) { myAttrs = attributesFlyweight; - myEnforcedDefaults = enforced; + myEnforceEmpty = enforced; } public TextAttributes(@NotNull Element element) { @@ -97,11 +98,11 @@ public class TextAttributes implements Cloneable { } public boolean isFallbackEnabled() { - return isEmpty() && !myEnforcedDefaults; + return isEmpty() && !myEnforceEmpty; } public boolean containsValue() { - return !isEmpty() || myEnforcedDefaults; + return !isEmpty() || myEnforceEmpty; } public void reset() { @@ -178,7 +179,7 @@ public class TextAttributes implements Cloneable { @Override public TextAttributes clone() { - return new TextAttributes(myAttrs, myEnforcedDefaults); + return new TextAttributes(myAttrs, myEnforceEmpty); } public boolean equals(Object obj) { @@ -202,7 +203,7 @@ public class TextAttributes implements Cloneable { } if (isEmpty()) { - myEnforcedDefaults = true; + myEnforceEmpty = true; } } @@ -216,7 +217,12 @@ public class TextAttributes implements Cloneable { getEffectColor() + "," + getErrorStripeColor() + "]"; } - public void setEnforcedDefaults(boolean enforcedDefaults) { - myEnforcedDefaults = enforcedDefaults; + /** + * Enforces empty attributes instead of treating empty values as undefined. + * + * @param enforceEmpty True if empty values should be used as is (fallback is disabled). + */ + public void setEnforceEmpty(boolean enforceEmpty) { + myEnforceEmpty = enforceEmpty; } } diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/TextAttributesReader.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/TextAttributesReader.java index f5414db1e973..39f2830ed2dc 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/TextAttributesReader.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/TextAttributesReader.java @@ -65,7 +65,7 @@ class TextAttributesReader extends ValueElementReader { FontStyle.read(this, element)); // needed for compatibility with TextAttributes(Element) if (attributes.isEmpty()) { - attributes.setEnforcedDefaults(true); + attributes.setEnforceEmpty(true); } } //noinspection unchecked diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/TextAttributesDescription.java b/platform/lang-impl/src/com/intellij/application/options/colors/TextAttributesDescription.java index 365e70006d9c..9d74f83dbbc8 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/TextAttributesDescription.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/TextAttributesDescription.java @@ -108,6 +108,6 @@ public abstract class TextAttributesDescription extends ColorAndFontDescription @Override public void setInherited(boolean isInherited) { super.setInherited(isInherited); - myAttributes.setEnforcedDefaults(!isInherited); + myAttributes.setEnforceEmpty(!isInherited); } }