Servo move to a location, then stop

Your original code does things based on whether a button is pressed or not. Edge detection is just fancy talk for reacting to changes in the button pressed-not pressed condition. Edges are when the switch goes from pressed to not pressed and vice versa.

In addition to looking for when a button becomes pressed, rather than when it is (still being) pressed, edge detection must usually include provision for contact bounce, the fact that buttons do not make closed circuits once and definitely when pressed, but rather exhibit a period (milliseconds time scale) during which successive reads of the digital input would yield a rapid and random series of HIGH and LOW values as the contacts eventually settle down and make good. Contact. That all under the general concept of debouncing, a subset of the larger problem which is deglitching any digital signal to ferret out meaningful states.

Well servos be servos, so one might find travel to be different. If however you are saying the some new code makes the servo go further when asked for 180 than some older code, that does sound impossible unexpected.

If the servo gets told to sweep open over to 180, and then you tell it nothing more, how you got there shouldn't matter.

If you have your hands on code that can demonstrate before and after, or two sketches that show this difference, post them here so we can have a peek and either explain what you are observing or we all learn something.

Have you told us the make and model of the servo?

a7