EditorGutterComponentEx: Don't add gap after the last annotation gutter

This commit is contained in:
Eldar Abusalimov
2019-01-23 14:58:43 +03:00
parent ba98d37360
commit c39ba25672
@@ -762,7 +762,8 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
private void calcAnnotationsSize() {
myTextAnnotationGuttersSize = 0;
final int lineCount = Math.max(myEditor.getDocument().getLineCount(), 1);
for (int j = 0; j < myTextAnnotationGutters.size(); j++) {
final int guttersCount = myTextAnnotationGutters.size();
for (int j = 0; j < guttersCount; j++) {
TextAnnotationGutterProvider gutterProvider = myTextAnnotationGutters.get(j);
int gutterSize = 0;
for (int i = 0; i < lineCount; i++) {
@@ -774,7 +775,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
gutterSize = Math.max(gutterSize, fontMetrics.stringWidth(lineText));
}
}
if (gutterSize > 0) gutterSize += getGapBetweenAnnotations();
if (gutterSize > 0 && j < guttersCount - 1) gutterSize += getGapBetweenAnnotations();
myTextAnnotationGutterSizes.set(j, gutterSize);
myTextAnnotationGuttersSize += gutterSize;
}