diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java index f91316cee0c0..0d0c3993e110 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java @@ -226,12 +226,20 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } private void paintEditorBackgrounds(Graphics g, Rectangle clip, int firstVisibleOffset, int lastVisibleOffset) { + int startX = getWhitespaceSeparatorOffset() + 1; IterationState state = new IterationState(myEditor, firstVisibleOffset, lastVisibleOffset, false, true); while (!state.atEnd()) { - g.setColor(state.getMergedAttributes().getBackgroundColor()); - int startX = getWhitespaceSeparatorOffset() + 1; - int y = myEditor.visualPositionToXY(myEditor.offsetToVisualPosition(state.getStartOffset())).y; - g.fillRect(startX, y, clip.width - startX, myEditor.getLineHeight()); + VisualPosition logicalStart = myEditor.offsetToVisualPosition(state.getStartOffset()); + int startY = myEditor.visualPositionToXY(logicalStart).y; + int endY = myEditor.visualPositionToXY(myEditor.offsetToVisualPosition(state.getEndOffset())).y; + if (logicalStart.getColumn() == 0) { + g.setColor(myEditor.getBackgroundColor(state.getMergedAttributes())); + g.fillRect(startX, startY, clip.width - startX, endY - startY + myEditor.getLineHeight()); + } + else if (startY != endY) { + g.setColor(myEditor.getBackgroundColor(state.getMergedAttributes())); + g.fillRect(startX, startY + myEditor.getLineHeight(), clip.width - startX, endY - startY + myEditor.getLineHeight()); + } state.advance(); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index 0770c310c5c7..575810823920 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -2100,7 +2100,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi myPlaceholderText = text; } - private Color getBackgroundColor(@NotNull final TextAttributes attributes) { + Color getBackgroundColor(@NotNull final TextAttributes attributes) { final Color attrColor = attributes.getBackgroundColor(); return Comparing.equal(attrColor, myScheme.getDefaultBackground()) ? getBackgroundColor() : attrColor; }