When creating a tiled background or adding roads, rivers, etc. using the paint tool, how do you trim any bits that are "hanging over the edge"?

Apologies if this has been asked and answered, but I've searched and can't find any mention.

Thanks,
Kevin