int TextImplementor.GetOffsetAtPoint(int x, int y, CoordType coords) { int rx = 0, ry = 0; switch (coords) { case Atk.CoordType.Screen: editor.TranslateCoordinates(editor, x, y, out rx, out ry); rx -= editor.TextViewMargin.XOffset; break; case Atk.CoordType.Window: rx = x - editor.TextViewMargin.XOffset; ry = y; break; } return(Document.LocationToOffset(editor.TextViewMargin.VisualToDocumentLocation(rx, ry))); }