int (LogicalPosition pos) { ThreadingAssertions.assertEventDispatchThread(); if (myDocument.getLineCount() == 0) return 0; if (pos.line < 0) throw new IndexOutOfBoundsException("Wrong line: " + pos.line); if (pos.column < 0) throw new IndexOutOfBoundsException("Wrong column:" + pos.column); if (pos.line >= myDocument.getLineCount()) { return myDocument.getTextLength(); } int start = myDocument.getLineStartOffset(pos.line); int end = myDocument.getLineEndOffset(pos.line); CharSequence text = myDocument.getCharsNoThreadCheck(); if (pos.column == 0) return start; return EditorUtil.calcOffset(this, text, start, end, pos.column, mySettings.getTabSize(myProject)); }