void (@NotNull RangeMarker marker) { Document document = marker.getDocument(); int startOffset = marker.getStartOffset(); int endOffset = marker.getEndOffset(); if (startOffset == endOffset || document.getImmutableCharSequence().charAt(endOffset - 1) != '\n') { marker.setGreedyToRight(true); document.insertString(endOffset, "\n"); } }