@NotNull public LogicalPosition hostToInjected(@NotNull LogicalPosition hPos) { assert isValid(); DocumentEx hostDocument = myDelegate.getDocument(); int hLineEndOffset = hPos.line >= hostDocument.getLineCount() ? hostDocument.getTextLength() : hostDocument.getLineEndOffset(hPos.line); LogicalPosition hLineEndPos = myDelegate.offsetToLogicalPosition(hLineEndOffset); if (hLineEndPos.column < hPos.column) { // in virtual space LogicalPosition iPos = myDocumentWindow.hostToInjectedInVirtualSpace(hPos); if (iPos != null) { return iPos; } } int hOffset = myDelegate.logicalPositionToOffset(hPos); int iOffset = myDocumentWindow.hostToInjected(hOffset); return offsetToLogicalPosition(iOffset); }
@Override public void parse(BserValues values) throws IOException { this.fileId = values.getLong(1); this.accessHash = values.getLong(2); this.fileSize = values.getInt(3); this.name = values.getString(4); this.mimeType = values.getString(5); this.thumb = values.optObj(6, new FastThumb()); if (values.optBytes(8) != null) { this.ext = DocumentEx.fromBytes(values.getBytes(8)); } if (values.hasRemaining()) { setUnmappedObjects(values.buildRemaining()); } }