@Override
    public @Nullable Rectangle getTextBounds(int startIndex, int endIndex) {
      LogicalPosition startPos = editor.offsetToLogicalPosition(startIndex);
      Point startPoint = editor.logicalPositionToXY(startPos);
      Rectangle rectangle = new Rectangle(startPoint);

      LogicalPosition endPos = editor.offsetToLogicalPosition(endIndex);
      Point endPoint = editor.logicalPositionToXY(endPos);
      FontMetrics fontMetrics = editor.getFontMetrics(Font.PLAIN);
      char c = editor.getDocument().getCharsSequence().subSequence(endIndex - 1, endIndex).charAt(0);
      endPoint.x += fontMetrics.charWidth(c);
      endPoint.y += fontMetrics.getHeight();
      rectangle.add(endPoint);

      return rectangle;
    }
@Override
    public @Nullable Rectangle getTextBounds(int startIndex, int endIndex)