From 2c0b2489b42b2feed677445b3ef88dcf038ac5d9 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 22 Jan 2016 15:56:32 +0300 Subject: [PATCH] removed starting gap if annotations area is the first visible --- .../openapi/editor/impl/EditorGutterComponentImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 9dda5a62e4a9..cc8700ec04be 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 @@ -117,6 +117,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse private static final int GAP_BETWEEN_ICONS = JBUI.scale(3); private static final int GAP_BETWEEN_AREAS = JBUI.scale(5); private static final int GAP_BETWEEN_ANNOTATIONS = JBUI.scale(5); + private static final int GAP_BEFORE_ANNOTATIONS = JBUI.scale(2); // inside the annotations area and with annotation background color private static final TooltipGroup GUTTER_TOOLTIP_GROUP = new TooltipGroup("GUTTER_TOOLTIP_GROUP", 0); public static final TIntFunction ID = new TIntFunction() { @Override @@ -428,7 +429,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse g.setColor(myEditor.getColorsScheme().getColor(gutterProvider.getColor(logLine, myEditor))); g.setFont(myEditor.getColorsScheme().getFont(style)); if (s != null) { - g.drawString(s, x, (j + 1) * lineHeight - myEditor.getDescent()); + g.drawString(s, GAP_BEFORE_ANNOTATIONS + x, (j + 1) * lineHeight - myEditor.getDescent()); } } @@ -686,7 +687,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse for (int i = 0; i < lineCount; i++) { final String lineText = gutterProvider.getLineText(i, myEditor); if (lineText != null) { - gutterSize = Math.max(gutterSize, fontMetrics.stringWidth(lineText)); + gutterSize = Math.max(gutterSize, GAP_BEFORE_ANNOTATIONS + fontMetrics.stringWidth(lineText)); } } if (gutterSize > 0) gutterSize += GAP_BETWEEN_ANNOTATIONS; @@ -1243,6 +1244,9 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse if (getLineNumberAreaWidth() == 0 && getAnnotationsAreaWidthEx() == 0 && getLineMarkerAreaWidth() == 0) { return getFoldingAreaWidth() == 0 ? 0 : 1; } + else if (getLineNumberAreaWidth() == 0 && getAnnotationsAreaWidthEx() > 0) { + return 0; // no gap if annotations area is the first visible + } else { return GAP_BETWEEN_AREAS; }