Commit 934a4de8 authored by Gregory.Shrago's avatar Gregory.Shrago
Browse files

introduce color-key fallback key as in text-attributes-key 2

parent b8970e7c
Showing with 11 additions and 8 deletions
+11 -8
......@@ -714,7 +714,7 @@ public abstract class AbstractColorsScheme extends EditorFontCacheImpl implement
Color parent = parentScheme instanceof DefaultColorsScheme ?
((DefaultColorsScheme)parentScheme).getColor(key, false) : parentScheme.getColor(key);
return Comparing.equal(parent, color);
return Comparing.equal(parent, color == NULL_COLOR_MARKER ? null : color);
}
).toList());
}
......
......@@ -21,7 +21,6 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.options.SchemeManager;
import com.intellij.openapi.options.SchemeState;
import com.intellij.util.ObjectUtils;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......@@ -47,11 +46,13 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl
if (attrs != null) return attrs;
TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
TextAttributes fallback = fallbackKey == null ? null : myAttributesMap.get(fallbackKey);
TextAttributes fallbackDefaults = fallbackKey == null ? null : getKeyDefaults(fallbackKey);
TextAttributes fallback = fallbackKey == null ? null : getFallbackAttributes(fallbackKey);
if (fallback != null && fallback != AbstractColorsScheme.INHERITED_ATTRS_MARKER) return fallback;
return useDefaults ? ObjectUtils.chooseNotNull(getKeyDefaults(key), fallbackDefaults) : null;
if (!useDefaults) return null;
TextAttributes keyDefaults = getKeyDefaults(key);
if (keyDefaults != null) return keyDefaults;
return fallbackKey == null ? null : getKeyDefaults(fallbackKey);
}
@Nullable
......@@ -71,11 +72,13 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl
if (color != null) return color;
ColorKey fallbackKey = key.getFallbackColorKey();
Color fallback = fallbackKey == null ? null : myColorsMap.get(fallbackKey);
Color fallbackDefault = fallbackKey == null ? null : fallbackKey.getDefaultColor();
Color fallback = fallbackKey == null ? null : getFallbackColor(fallbackKey);
if (fallback != null && fallback != AbstractColorsScheme.INHERITED_COLOR_MARKER) return fallback;
return useDefaults ? ObjectUtils.chooseNotNull(key.getDefaultColor(), fallbackDefault) : null;
if (!useDefaults) return null;
Color keyDefaults = key.getDefaultColor();
if (keyDefaults != null) return keyDefaults;
return fallbackKey == null ? null : fallbackKey.getDefaultColor();
}
@Override
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment