@Override
    public @NotNull Rectangle modelToView(JTextComponent tc, int offset, Position.Bias bias) {
      LogicalPosition pos = editor.offsetToLogicalPosition(offset).leanForward(bias == Position.Bias.Forward);
      LogicalPosition posNext = editor.offsetToLogicalPosition(bias == Position.Bias.Forward ? offset + 1 : offset - 1)
        .leanForward(bias != Position.Bias.Forward);
      Point point = editor.logicalPositionToXY(pos);
      Point pointNext = editor.logicalPositionToXY(posNext);
      return point.y == pointNext.y
             ? new Rectangle(Math.min(point.x, pointNext.x), point.y, Math.abs(point.x - pointNext.x), editor.getLineHeight())
             : new Rectangle(point.x, point.y, 0, editor.getLineHeight());
    }
@Override
    public @NotNull Rectangle modelToView(JTextComponent tc, int offset, Position.Bias bias)