private void paintCaretText(@NotNull Graphics2D g,
                                @Nullable Caret caret,
                                @NotNull Color caretColor,
                                float x,
                                float y,
                                int topOverhang,
                                boolean isRtl) {
      if (caret != null) {
        int targetVisualColumn = caret.getVisualPosition().column - (isRtl ? 1 : 0);
        for (VisualLineFragmentsIterator.Fragment fragment : VisualLineFragmentsIterator.create(myView,
                                                                                                caret.getVisualLineStart(),
                                                                                                false)) {
          if (fragment.getCurrentInlay() != null) continue;
          int startVisualColumn = fragment.getStartVisualColumn();
          int endVisualColumn = fragment.getEndVisualColumn();
          if (startVisualColumn <= targetVisualColumn && targetVisualColumn < endVisualColumn) {
            g.setColor(ColorUtil.isDark(caretColor) ? CARET_LIGHT : CARET_DARK);
            fragment.draw(x, y + topOverhang + myAscent,
                          fragment.visualColumnToOffset(targetVisualColumn - startVisualColumn),
                          fragment.visualColumnToOffset(targetVisualColumn + 1 - startVisualColumn)).accept(g);
            break;
          }
        }
        ComplexTextFragment.flushDrawingCache(g);
      }
    }
private void paintCaretText(@NotNull Graphics2D g,
                                @Nullable Caret caret,
                                @NotNull Color caretColor,
                                float x,
                                float y,
                                int topOverhang,
                                boolean isRtl)