LogicalPosition (@NotNull LogicalPosition pos) { assertValid(); int offset = logicalPositionToOffset(pos); LogicalPosition samePos = offsetToLogicalPosition(offset); int virtualSpaceDelta = offset < myDocumentWindow.getTextLength() && samePos.line == pos.line && samePos.column < pos.column ? pos.column - samePos.column : 0; LogicalPosition hostPos = myDelegate.offsetToLogicalPosition(myDocumentWindow.injectedToHost(offset)); return new LogicalPosition(hostPos.line, hostPos.column + virtualSpaceDelta); }