int lineOffset = content.getOffsetAtLine(lineIndex); TextLayout layout = renderer.getTextLayout(lineIndex); x += horizontalScrollOffset - leftMargin;
int getOffsetAtPoint(int x, int y) {	int lineIndex = getLineIndex(y);	int lineOffset = content.getOffsetAtLine(lineIndex);	TextLayout layout = renderer.getTextLayout(lineIndex);	x += horizontalScrollOffset - leftMargin;	y -= getLinePixel(lineIndex);	int[] trailing = new int[1];	if (wordWrap) {		//TODO	}		int offsetInLine = layout.getOffset(x, y, trailing);	advancing = false;	if (trailing[0] != 0) {		int lineInParagraph = layout.getLineIndex(offsetInLine);		int lineLength;		if (lineInParagraph + 1 == layout.getLineCount()) {			lineLength = layout.getLineOffsets()[lineInParagraph + 1];		} else {			lineLength = Math.max(0, layout.getLineOffsets()[lineInParagraph + 1] - 1);		}		if (offsetInLine + trailing[0] >= lineLength) {			offsetInLine = lineLength;			advancing = true;		} else {			String line = content.getLine(lineIndex);						int level;			int offset = offsetInLine;			while (offset > 0 && Character.isDigit(line.charAt(offset))) offset--;			if (offset == 0 && Character.isDigit(line.charAt(offset))) {				level = isMirrored() ? 1 : 0;			} else {				level = layout.getLevel(offset) & 0x1;			}			offsetInLine += trailing[0];			int trailingLevel = layout.getLevel(offsetInLine) & 0x1;			advancing  = (level ^ trailingLevel) != 0;		}	}	renderer.disposeTextLayout(layout);	return offsetInLine + lineOffset;}