@Override
    public int viewToModel(JTextComponent tc, Point pt) {
      LogicalPosition logicalPosition = editor.xyToLogicalPosition(pt);
      return editor.logicalPositionToOffset(logicalPosition);
    }
@Override
    public int viewToModel(JTextComponent tc, Point pt)