private int DoMouseEventToIndex(NSTextView view, NSEvent evt) { NSPoint baseLoc = evt.locationInWindow(); NSPoint viewLoc = view.convertPointFromBase(baseLoc); return (int) view.characterIndexForInsertionAtPoint(viewLoc); }