Also, when you've misclicked like that with a ranged attack, you can right click to stop moving.
This is also useful if you're an idiot like me and forget to select - say - Staff of Magus before clicking the target, and find yourself running over to poke them with your staff.