diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/HighlighterLayer.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/HighlighterLayer.java index 831aab757153..779b3f534315 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/HighlighterLayer.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/HighlighterLayer.java @@ -16,8 +16,8 @@ package com.intellij.openapi.editor.markup; public interface HighlighterLayer { - int CARET_ROW = 1000; - int SYNTAX = 2000; + int SYNTAX = 1000; + int CARET_ROW = 2000; int ADDITIONAL_SYNTAX = 3000; int GUARDED_BLOCKS = 3500; int WARNING = 4000; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/IterationState.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/IterationState.java index f1ac3f8a2bd2..8acaf90927fb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/IterationState.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/IterationState.java @@ -462,16 +462,16 @@ public final class IterationState { guard = null; } - if (syntax != null && highlighter.getLayer() < HighlighterLayer.SYNTAX) { - cachedAttributes.add(syntax); - syntax = null; - } - if (caret != null && highlighter.getLayer() < HighlighterLayer.CARET_ROW) { cachedAttributes.add(caret); caret = null; } + if (syntax != null && highlighter.getLayer() < HighlighterLayer.SYNTAX) { + cachedAttributes.add(syntax); + syntax = null; + } + TextAttributes textAttributes = highlighter.getTextAttributes(); if (textAttributes != null && textAttributes != TextAttributes.ERASE_MARKER) { cachedAttributes.add(textAttributes); @@ -484,8 +484,8 @@ public final class IterationState { if (selection != null) cachedAttributes.add(selection); if (fold != null) cachedAttributes.add(fold); if (guard != null) cachedAttributes.add(guard); - if (syntax != null) cachedAttributes.add(syntax); if (caret != null) cachedAttributes.add(caret); + if (syntax != null) cachedAttributes.add(syntax); Color fore = null; Color back = isInGuardedBlock ? myReadOnlyColor : null; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/IterationState.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/IterationState.java index 620208b280e9..f6066c69f1d5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/IterationState.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/IterationState.java @@ -516,16 +516,16 @@ public class IterationState { guard = null; } - if (syntax != null && highlighter.getLayer() < HighlighterLayer.SYNTAX) { - cachedAttributes.add(syntax); - syntax = null; - } - if (caret != null && highlighter.getLayer() < HighlighterLayer.CARET_ROW) { cachedAttributes.add(caret); caret = null; } + if (syntax != null && highlighter.getLayer() < HighlighterLayer.SYNTAX) { + cachedAttributes.add(syntax); + syntax = null; + } + TextAttributes textAttributes = highlighter.getTextAttributes(); if (textAttributes != null && textAttributes != TextAttributes.ERASE_MARKER) { cachedAttributes.add(textAttributes); @@ -535,8 +535,8 @@ public class IterationState { if (selection != null) cachedAttributes.add(selection); if (fold != null) cachedAttributes.add(fold); if (guard != null) cachedAttributes.add(guard); - if (syntax != null) cachedAttributes.add(syntax); if (caret != null) cachedAttributes.add(caret); + if (syntax != null) cachedAttributes.add(syntax); Color fore = null; Color back = isInGuardedBlock ? myReadOnlyColor : null; diff --git a/platform/platform-tests/testData/editor/painting/caretRowHasLowerPriorityThanSyntax.png b/platform/platform-tests/testData/editor/painting/caretRowHasLowerPriorityThanSyntax.png deleted file mode 100644 index a1abb680a19d..000000000000 Binary files a/platform/platform-tests/testData/editor/painting/caretRowHasLowerPriorityThanSyntax.png and /dev/null differ diff --git a/platform/platform-tests/testData/editor/painting/caretRowWinsOverSyntaxEvenInPresenceOfHighlighter.png b/platform/platform-tests/testData/editor/painting/caretRowWinsOverSyntaxEvenInPresenceOfHighlighter.png new file mode 100644 index 000000000000..c8fb28e88f96 Binary files /dev/null and b/platform/platform-tests/testData/editor/painting/caretRowWinsOverSyntaxEvenInPresenceOfHighlighter.png differ diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingTest.java index 197f47d77f7a..72bcca058e93 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorPaintingTest.java @@ -69,9 +69,10 @@ public class EditorPaintingTest extends AbstractEditorTest { checkResult(); } - public void testCaretRowHasLowerPriorityThanSyntax() throws Exception { + public void testCaretRowWinsOverSyntaxEvenInPresenceOfHighlighter() throws Exception { initText("foo"); setUniformEditorHighlighter(new TextAttributes(null, Color.red, null, null, Font.PLAIN)); + addRangeHighlighter(0, 3, 0, null, Color.blue); checkResult(); }