synchronized int logicalPositionToOffset(@NotNull LogicalPosition pos) {
    int line = pos.line;
    int column = pos.column;
    if (line >= myDocument.getLineCount()) return myDocument.getTextLength();
    if (myUpdateInProgress) {
      // direct calculation when we cannot use cache
      // (use case - com.intellij.openapi.editor.impl.CaretImpl.PositionMarker.changedUpdateImpl())
      int lineStartOffset = myDocument.getLineStartOffset(line);
      int lineEndOffset = myDocument.getLineEndOffset(line);
      return calcOffset(myDocument.getImmutableCharSequence(), column, 0, lineStartOffset, lineEndOffset, myTabSize);
    }
    LineData lineData = getLineInfo(line);
    return lineData.logicalColumnToOffset(myDocument, line, myTabSize, column);
  }
synchronized int logicalPositionToOffset(@NotNull LogicalPosition pos)