void (int start, int end) { gutterContentProvider.beforeUiComponentUpdate(editor); if (atLineStart) { return; } if (!gutterContentProvider.hasText()) { editor.getSettings().setAdditionalColumnsCount(1); maxContentWidth = 0; return; } FontMetrics fontMetrics = editor.getFontMetrics(Font.PLAIN); int lineCount = Math.min(end, editor.getDocument().getLineCount()); int gutterSize = 0; for (int line = start; line < lineCount; line++) { String text = gutterContentProvider.getText(line, editor); if (text != null) { gutterSize = Math.max(gutterSize, fontMetrics.stringWidth(text)); } } // line start gutter always has gap if (gutterSize != 0) { gutterSize += gap; } maxContentWidth = Math.max(gutterSize, maxContentWidth); editor.getSettings().setAdditionalColumnsCount(1 + (maxContentWidth / EditorUtil.getSpaceWidth(Font.PLAIN, editor))); }