static int calcOffset(@NotNull CharSequence text, int column, int startColumn, int startOffset, int endOffset, int tabSize) {
    int currentColumn = startColumn;
    for (int i = startOffset; i < endOffset; i++) {
      char c = text.charAt(i);
      if (c == '\t') {
        currentColumn = (currentColumn / tabSize + 1) * tabSize;
      }
      else if (i + 1 < text.length() && Character.isHighSurrogate(c) && Character.isLowSurrogate(text.charAt(i + 1))) {
        if (currentColumn == column) return i;
      }
      else {
        currentColumn++;
      }
      if (currentColumn > column) return i;
    }
    return endOffset;
  }
static int calcOffset(@NotNull CharSequence text, int column, int startColumn, int startOffset, int endOffset, int tabSize)