diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/TextAnnotationGutterProvider.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/TextAnnotationGutterProvider.java index 80ad4636ad0b..329ea6080221 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/TextAnnotationGutterProvider.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/TextAnnotationGutterProvider.java @@ -71,4 +71,12 @@ public interface TextAnnotationGutterProvider { * @see EditorGutter#closeAllAnnotations() */ void gutterClosed(); + + /** + * If {@code true}, a couple of pixels will be added at both sides of displayed text (if it's not empty), + * otherwise the width of annotation will be equal to the width of provided text. + */ + default boolean useMargin() { + return true; + } } 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 a043ab86571b..6dccf1a0b97a 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 @@ -487,7 +487,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse EditorFontType style = gutterProvider.getStyle(line, myEditor); Font font = getFontForText(s, style); g.setFont(font); - g.drawString(s, getGapBetweenAnnotations() / 2 + x, y + myEditor.getAscent()); + g.drawString(s, (gutterProvider.useMargin() ? getGapBetweenAnnotations() / 2 : 0) + x, y + myEditor.getAscent()); } } @@ -772,7 +772,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse gutterSize = Math.max(gutterSize, fontMetrics.stringWidth(lineText)); } } - if (gutterSize > 0 && j < guttersCount - 1) gutterSize += getGapBetweenAnnotations(); + if (gutterSize > 0 && gutterProvider.useMargin()) gutterSize += getGapBetweenAnnotations(); myTextAnnotationGutterSizes.set(j, gutterSize); myTextAnnotationGuttersSize += gutterSize; }