In the situation you describe, the Church requires that ordinary means of maintaining life (nourishment and hydration, for example) not be denied. But it does allow the cessation of extraordinary means:
“Discontinuing medical procedures that are burdensome, dangerous, extraordinary, or disproportionate to the expected outcome can be legitimate; it is the refusal of ‘over-zealous’ treatment. Here one does not will to cause death; one’s inability to impede it is merely accepted. The decisions should be made by the patient if he is competent, whose reasonable will and legitimate interests must always be respected” (CCC 2278).