int x = point.x - leftMargin + horizontalScrollOffset;
int x = point.x + horizontalScrollOffset - leftMargin ;
public int getOffsetAtLocation(Point point) {	checkWidget();	if (point == null) {		SWT.error(SWT.ERROR_NULL_ARGUMENT);	}	// is y above first line or is x before first column?	if (point.y + verticalScrollOffset < 0 || point.x + horizontalScrollOffset < 0) {		SWT.error(SWT.ERROR_INVALID_ARGUMENT);	}	int bottomIndex = getLineIndex(getClientArea().height);	int height = getLinePixel(bottomIndex) + lineCache.getLineHeight(bottomIndex);	if (point.y > height) {		SWT.error(SWT.ERROR_INVALID_ARGUMENT);			}	int lineIndex = getLineIndex(point.y);	String line = content.getLine(lineIndex);	int lineOffset = content.getOffsetAtLine(lineIndex);	TextLayout layout = renderer.getTextLayout(line, lineOffset);		int[] trailing = new int[1];	int x = point.x - leftMargin + horizontalScrollOffset;	int y = point.y - getLinePixel(lineIndex);	int offsetInLine = layout.getOffset(x, y, trailing);	if (offsetInLine != line.length() - 1) {		offsetInLine = Math.min(line.length(), offsetInLine + trailing[0]);			}	Rectangle rect = layout.getLineBounds(layout.getLineIndex(offsetInLine));	renderer.disposeTextLayout(layout);	if (x > rect.x + rect.width) {		SWT.error(SWT.ERROR_INVALID_ARGUMENT);	}	return lineOffset + offsetInLine;}