private static boolean fitsInCaretLine(Editor editor, int windowRight) {
      if (ApplicationManager.getApplication().isUnitTestMode() || editor.isOneLineMode()) return false;
      if (Registry.is("always.show.intention.above.current.line", false)) return false;

      int visualCaretLine = editor.offsetToVisualPosition(editor.getCaretModel().getOffset()).line;
      int textColumn = EditorActionUtil.findFirstNonSpaceColumnOnTheLine(editor, visualCaretLine);
      if (textColumn == -1) return false;

      int safetyColumn = Math.max(0, textColumn - 2); // 2 characters safety margin, for IDEA-313840.
      int textX = editor.visualPositionToXY(new VisualPosition(visualCaretLine, safetyColumn)).x;
      return textX > windowRight;
    }
private static boolean fitsInCaretLine(Editor editor, int windowRight)