private int logicalColumnToOffset(@NotNull Document document, int line, int tabSize, int logicalColumn) {
      int lineStartOffset = document.getLineStartOffset(line);
      int lineEndOffset = document.getLineEndOffset(line);
      if (columnCache == null) {
        int result = lineStartOffset + logicalColumn;
        return result < 0 || // guarding over overflow
               result > lineEndOffset ? lineEndOffset : result;
      }
      int pos = Arrays.binarySearch(columnCache, logicalColumn);
      if (pos >= 0) {
        int result = lineStartOffset + (pos + 1) * CACHE_FREQUENCY;
        return DocumentUtil.isInsideSurrogatePair(document, result) ? result - 1 : result;
      }
      int startOffset = lineStartOffset + (- pos - 1) * CACHE_FREQUENCY;
      int column = pos == -1 ? 0 : columnCache[- pos - 2];
      return calcOffset(document.getImmutableCharSequence(), logicalColumn, column, startOffset, lineEndOffset, tabSize);
    }
private int logicalColumnToOffset(@NotNull Document document, int line, int tabSize, int logicalColumn)